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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:42:27+00:00 2026-05-27T09:42:27+00:00

just wondering what selector performance is like for [data=what] pseudo performance if anyone has

  • 0

just wondering what selector performance is like for [data=”what”] pseudo performance if anyone has a good article/benchmark for this or any personal experience?

Basically I’ve peppered my HTML with data-eid, data-mid, data-sid with HTML5 elements like:

<section data-mid="1">
    <article data-eid="1">
        <a data-sid="1"></a>
        <a data-sid="2"></a>
        <a data-sid="3"></a>
    </article>
    <article data-eid="2">
        <a data-sid="4"></a>
        <a data-sid="5"></a>
        <a data-sid="6"></a>
    </article>
</section>
<section data-mid="2">
    <article data-eid="3">
        <a data-sid="7"></a>
        <a data-sid="8"></a>
        <a data-sid="9"></a>
    </article>
    <article data-eid="4">
        <a data-sid="10"></a>
        <a data-sid="11"></a>
        <a data-sid="12"></a>
    </article>
</section>

Pretty much wanted to use it in jQuery for selecting particular m e and s things on my page. I know atm that an m is a section, that an e is an article and an s is an anchor.

I would usually select in jQuery using something like $('.m[mid="1"]') but is it much quicker than: $('section[mid="1"]')… I guess not?

I just don’t want to make the user download a load of extra class=”m” in my code. I know currently I’m tying my front-end with my JS-end code by forcing the elements to be a certain type where class=”m” would decouple it to be anything in the future.

What do you think?

  • 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-27T09:42:28+00:00Added an answer on May 27, 2026 at 9:42 am

    When I write HTML that’s intended to communicate something to unobtrusive JavaScript that’s going to control behavior, I do this:

    <div class='some-behavior' data-param-for-behavior='whatever' data-another-param='12'>
    

    Then the code can apply itself based on class name, which is (in modern browsers) pretty fast, and get the parameters with “.data()”.

    Fetching by class name:

    var elementsToControl = $('.some-behavior');
    

    in modern browsers is way faster than

    var elementsToControl = $('[data-param-for-behavior]');
    

    edit — wow mind blown – the by-attribute method, with a tag name, is faster than by-class in Chrome. I’ll try by-class with a tag name too … edit again nope. Boy, sometimes I just wonder 🙂

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

Sidebar

Related Questions

Just wondering if anyone has any favourite SQL references they to use when creating
Was wondering if anyone knows, or has pointers to good documentation that discusses, the
just wondering if anyone knows of a truly restful Put/delete implementation asp.net mvc preview
Just wondering why people like case sensitivity in a programming language? I'm not trying
Just wondering if there's any tutorials or ways to update jQuery scripts and functions.
i'm new to obj-c and i was just wondering if someone could explain this.
I'm working on some complicated form at the moment. Just wondering, is there any
So, I have a UISegmentedControl with: [control addTarget:self action:@selector(myAction) forControlEvents:UIControlEventValueChanged]; Just wondering how I
Just wondering if a .NET app can be compiled down to native machine code
Just wondering if there is an easy way to add the functionality to duplicate

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.