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 5948811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:09:41+00:00 2026-05-22T17:09:41+00:00

Just throwing this question out here ’cause it got me thinking tonight. I’ve heard

  • 0

Just throwing this question out here ’cause it got me thinking tonight.

I’ve heard before that it’s way better to include the HTML tag into a jQuery selector whenever you could, because it kicks up selection performance by, well, telling jQuery what HTML tags to look for so it doesn’t search everything in the document. (i.e. go $('div.someclass') instead of $('.someclass') when you could.)

My question is, how true is this now, with the current version of jQuery (currently 1.6.1)?

I’m not even sure if this notion came pre-Sizzle (not even sure if Sizzle helps jQuery perform better in this respect).

Of course, good coding practice would dictate that I include the HTML tag whenever I could just to keep things clear, but there’s a very gray area for me when I’d prefer to go

$('.someclass')

just because I don’t want to go

$('div.someclass, a.someclass, p.someclass, img:nth-child(3n+2).someclass')

Completely theoretical only dudes. I know I can just go $('div,a,p,img:nth-child(3n+2)').filter('.someclass').

EDIT

On a somewhat related note, I went ahead and made perf tests on with-tag vs without-tag selection (thanks Raynos), and seemingly, without-tag selection was significantly more beneficial than with-tag selection on FF and Chrome. with-tag was still faster on IE8, but by the looks of the narrow margin, it’s completely eclipsed by the alternative on other browsers. Hmm.

  • 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-22T17:09:41+00:00Added an answer on May 22, 2026 at 5:09 pm

    $('.someclass') Should be a lot faster then $("div.someclass, p.someclass")

    It’s only worthwhile being specific if it doesn’t broaden the query.

    Benchmark

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

Sidebar

Related Questions

Just found this out, so i am answering my own question :) Use a
Just looking for the first step basic solution here that keeps the honest people
I just asked this question . In short, when you throw from a win32
I am aware that this question is a raging duplicate of this question. However
I realize that this question might not make sense to some, but I was
This is not a question about real code, it is just for discussion. It
Thanks to this question I managed to work out how to constrain my generic
Noob question here. I'm following this example/tutorial to try and isolate a problem I
just a quick question: I am a CS undergrad and have only had experience
Just how much slower are events? I have written a streaming XML parser (that

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.