<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>67868</bug_id>
          
          <creation_ts>2011-09-09 15:26:55 -0700</creation_ts>
          <short_desc>Optimize CSS rule handling for body and html for efficient CSS</short_desc>
          <delta_ts>2011-09-10 03:08:47 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>CSS</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Steven Roussey">sroussey</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>hyatt</cc>
    
    <cc>koivisto</cc>
    
    <cc>paulirish</cc>
    
    <cc>phiw2</cc>
    
    <cc>simon.fraser</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>465058</commentid>
    <comment_count>0</comment_count>
    <who name="Steven Roussey">sroussey</who>
    <bug_when>2011-09-09 15:26:55 -0700</bug_when>
    <thetext>For quite some time, several frameworks, ExtJS for example, have used the html and body tags as a place to add classes so that they can target specific browsers or browser capabilities in css rules. For example a class &quot;x-ie6&quot; will be added in IE6 to the body element. You can see examples in the ext-all.css file[1]. And there are now a bunch of sites using Modernizr (and look at what they do to the html element!)[2].

Taking advantage of these classes on html and body makes it easy to target &quot;fixes&quot; or &quot;features&quot; for certain browsers. Typical would be using CSS3 to style a button with gradients and rounded borders and drop shadows, or in old versions of IE using image spriting instead.

Companies that use Sencha&apos;s ExtJS, for example, could reap some reward if Sencha changed its CSS to have:

body.x-ie6 .buttonClsExample {}

instead of 

.x-ie6 .buttonClsExample

And the browser could remove all the body.x-ie6 * rules. According to the Mozilla guide on efficient CSS[3], this would be a real gain.

I have also made a bug report for Mozilla[4].

[1] http://dev.sencha.com/deploy/ext-4.0.2a/resources/css/ext-all.css
[2] http://www.modernizr.com/
[3] https://developer.mozilla.org/en/Writing_Efficient_CSS
[4] https://bugzilla.mozilla.org/show_bug.cgi?id=678568</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>465071</commentid>
    <comment_count>1</comment_count>
    <who name="Paul Irish">paulirish</who>
    <bug_when>2011-09-09 15:50:00 -0700</bug_when>
    <thetext>
On the mozilla bug, David Baron explained the fast path for this one: https://bugzilla.mozilla.org/show_bug.cgi?id=678568#c2

Modernizr is used in the HTML5 Boilerplate and ships with Visual Studio, so documentElement classes are certainly a lot more popular than in the past. A fastpath here would be excellent.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>465223</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2011-09-09 22:30:36 -0700</bug_when>
    <thetext>We already optimize descendant selectors. I&apos;m not sure there&apos;s more.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>465276</commentid>
    <comment_count>3</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2011-09-10 03:08:47 -0700</bug_when>
    <thetext>Sounds like Gecko should optimize descendant selectors properly. We already do, there is no particular need for body specific hacks like this.
 
Almost nothing in that &quot;Efficient CSS&quot; guide is relevant to current WebKit.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>