Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7652217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:42:41+00:00 2026-05-31T11:42:41+00:00

Assuming there are no duplicate IDs in the DOM and $parent is a jQuery

  • 0

Assuming there are no duplicate IDs in the DOM and $parent is a jQuery object containing a single element that is the parent of #myID

var $el = $("#myID");

vs

var $el = $("#myID", $parent);  //Faster or slower?

Is there a speed difference between the two of these?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T11:42:43+00:00Added an answer on May 31, 2026 at 11:42 am

    Is there a speed benefit to specifying a context when selecting by id in jQuery?

    No, it actually makes things slower (or at least, it can), because jQuery has a special path for simple ID selectors and uses document.getElementById — but only if you don’t give a context. So giving a context will slow things down (or at least, might slow things down), because jQuery won’t be able to take that shortcut. The relevant check is on line 135 of the current uncompressed jQuery release (v1.7.1).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assuming that I know there is a git-daemon running at git://git.mycompany.com , how can
Is there a cleaner way to do the following, assuming that I have a
Assuming there are 5 items in the settings file ( MySetting1 to MySetting5 ),
Assuming there are 5 inputs in web form <input name='the_same[]' value='different' /> <input name='the_same[]'
Should I be separating my js for each page assuming there is no overlap
I'm currently estimating a new project. My high level estimate assuming there was one
Assuming Windows, is there a way I can detect from within a batch file
Assuming I have fonts installed which have the appropriate glyphs in them, is there
Are there any way to access or set iphone's alarm? Im assuming if this
Assuming I have no control over the content in the iframe, is there any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.