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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:39:24+00:00 2026-06-14T13:39:24+00:00

I recently had a quick look at the new jQuery Sizzle, i was wondering

  • 0

I recently had a quick look at the new jQuery Sizzle, i was wondering if there is any significant performance difference between using Sizzle.matchesSelector or assessing directly the attribute of the element parameter :

$.expr.createPseudo(function(selector) {
  return function( elem ) {
    return elem.getAttribute('data-smth').match(/someRegex/)
  }
}

VS :

$.expr.createPseudo(function(selector) {
  return function( elem ) {
    return $.find.matchesSelector(elem, 'div.someClass[data-smth*=smth]')
  }
}

I find personaly matchesSelector easier since we keep on jquery level and we can add easily some constraints (.someClass in my exemple above)

  • 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-06-14T13:39:25+00:00Added an answer on June 14, 2026 at 1:39 pm

    The difference is that .matchesSelector() is a function that is either native or a custom one created by the Sizzle developers. In the case of a native function, the difference, although .getAttribute() would still be faster, would be lesser. However, in case of a custom function, the difference would be greater, definitely in favor of .getAttribute().

    .matchesSelector(), however, safely queries attributes, so that is something to keep in mind.

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

Sidebar

Related Questions

Folks, I had a quick question about Amazon EC2, I have been recently using
I recently had a little problem using a jquery plugin with coffeescript (within the
I recently had to take a quick look at Adobe InDesign server. In this
Recently had an interviewer ask to define the difference between objects and primitives. Seemed
I recently had cause to look at the documentation for the -XX:MaxPermSize argument to
I recently had an idea to create my own String class to make using
Recently I have been exploring using the fancy new dynamic keyword introduced in C#
I recently had to troubleshoot a performance problem with a slow grid load. Upon
I recently had help getting the correct Date format on my jQuery / tablesorter
I recently had a similar thread about this, but now I need to animate

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.