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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:25:17+00:00 2026-06-05T06:25:17+00:00

So I am building a set of JavaScript (jQuery) widgets and something I want

  • 0

So I am building a set of JavaScript (jQuery) widgets and something I want to make sure is that all the elements for these widgets are using box-sizing: border-box (and yes, I am aware this means I can only support an IE version of 8 or higher which I am fine with).

Now I have heard that doing a [selector] > * is very slow but just how slow is it?

I mean for just one of the widgets, I have this selector to make sure all elements have the right box-sizing:

.jg-grid-wrap,
.jg-grid-content-outer-wrap,
.jg-grid-colum-actions a,
.jg-grid-content-wrap,
.jg-grid-wrap .hide,
.jg-grid-wrap ul,
.jg-grid-wrap ul li,
.jg-grid-header-wrap,
.jg-grid-header-wrap li,
.jg-grid-header-wrap .sort-indicator,
.jg-grid-row,
.jg-grid-row li,
.jg-grid-footer-wrap,
.jg-grid-footer-wrap .column-selection
.jg-grid-wrap .controls,
.jg-grid-wrap .controls .first-page-link,
.jg-grid-wrap .controls .previous-page-link,
.jg-grid-wrap .controls .next-page-link,
.jg-grid-wrap .controls .last-page-link,
.jg-grid-wrap .controls .column-selection-link,
.jg-grid-wrap .controls .set-page-link,
.jg-grid-wrap .controls .total-page-count,
.jg-grid-wrap .controls .record-counts,
.jg-grid-wrap .controls .record-display-text
{
    box-sizing: border-box;
}

but it would be a lot smaller and easier to just write:

.jg-grid-wrap *
{
    box-sizing: border-box;
}

Also, if I add an element, I now have to remember to add that to the huge selector where with the star one, I don’t have to worry about it.

Is it really worth my time to list out every single possible element individually because the [selector] > * is really that slow?

UPDATE

In the end, I am just going to go with:

[class^=jg-] *
{
    box-sizing: border-box;
}

This selector has a ~14% of a total of 4ms based on google chrome. Other has a bit smaller (~4%) however thinking about it, CSS is going to be the last place that I probably need to worry about performance (my javascript and server side code will be the bulk of the bottleneck). If I really need to optimize my CSS chrome profiler is there when I need it.

  • 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-05T06:25:19+00:00Added an answer on June 5, 2026 at 6:25 am

    If you really want all elements under the container marked with that class, you’d want

    .jg-grid-wrap *
    

    The > operator limits the match to direct children.

    The performance impact stems from the fact that it means every element has to be tested when the layout is updated in relevant ways. You could make it a little better with:

    .jg-grid-wrap div, .jg-grid-wrap form, .jg-grid-wrap ul
    

    etc, with whatever block-level elements you really care about. (That is, do you really care if your <span> tags have the “box-sizing” property?)

    Chrome’s CSS profiler can be pretty helpful in finding expensive CSS rules. This should be something you investigate empirically before worrying about it too much; modern CSS engines are pretty fast.

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

Sidebar

Related Questions

I'm building a mobile app using HTML, CSS, Javascript and jQuery. Is there a
I'm using a lot of JQuery in a web application that I am building
I'm building a set of SVG files that include an unfortunate number of hardcoded
I am building an asp.net c# application that is heavily reliant on javascript and
Situation: A PHP Templating system that is responsible for building a pages HTML. Javascript
I'm building a simple Javascript jukebox using the latest SoundManager2 for audio playback, with
Okay, I'm building a quiz application in jQuery/javascript. The following little function is intended
I am building a html menu and I am using jQuery UI to format
Am building an app using Django as my workhorse. All has been well so
I'm getting more into jQuery and so have set up a HTML/Javascript/CSS base site

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.