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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:05:20+00:00 2026-05-14T03:05:20+00:00

Is this faster: $(document.links).filter(‘a.someClass’) than just plain old this: $(‘a.someClass’) ? I don’t see

  • 0

Is this faster:

$(document.links).filter('a.someClass')

than just plain old this:

$('a.someClass')

?

I don’t see anywhere in jQuery’s code the utilization of document.links
which gives you the collection of links on the document right away,
than, it would seem, it would be faster to just filter in the collection
instead of all the DOM nodes, which is alot more nodes to go over.

  • 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-14T03:05:20+00:00Added an answer on May 14, 2026 at 3:05 am

    Theoretically, iterating document.links will be a bit faster than jQuery’s Sizzle selector library. However:

    • not the way you’re doing it with filter, which gives jQuery just as much work to do than it would have to do using Sizzle to pick the elements in the first place;

    • document.links won’t necessarily give you exactly the same as $('a'), as a-without-href doesn’t appear in the links collection.

    • the direct $('a.someClass') method will be much faster than even manually iterating document.links in modern browsers, because that method will just transfer control to the browser’s own implementation of document.querySelectorAll('a.someClass'), which will be much faster than anything your or Sizzle could do sniffing at DOM Nodes yourself.

    (There is one slightly faster method than querySelectorAll, which jQuery doesn’t use yet: document.getElementsByClassName('someClass'). Again, it’s only in modern browsers though, and IE8 doesn’t have it where it does have querySelectorAll. In practice it’s probably not worth bothering about too much as querySelectorAll is already very fast.)

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

Sidebar

Related Questions

This function is much faster than its recursive version: crossSubstrings :: String -> String
This consists of two questions: Is MySQL's timestamp field really faster than datetime field
Is there any other method that is faster than doing like this? private void
Could you help me to make this query faster. My query is workable, but
With this code I guess the scan was faster, but the scan always return
Is it better / faster inside an event listener to use this or event.target
According to this JSPerf the While ! Undefined style array loop is ~10x faster
I want to ask if is there any faster method how to make this
I heard that SQL is faster if table relationships are defined. Is this true?
I'm writing my own Document Management System (DMS) in Java (the ones available don't

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.