Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It shouldn't have any effect upon the performance really. Seeing <strong>firefox's CSS parser at <a href="http://mxr.mozilla.org/mozilla2.0/source/layout/style/nsCSSDataBlock.cpp#572" rel="noreferrer"><code>/source/layout/style/nsCSSDataBlock.cpp#572</code></a></strong> and I think that is the relevant routine, handling <strong>overwriting</strong> of CSS rules.</p> <p>it just seems to be an simple check for "important".</p> <pre><code> if (aIsImportant) { if (!HasImportantBit(aPropID)) changed = PR_TRUE; SetImportantBit(aPropID); } else { // ... </code></pre> <p>Also, comments at <strong><a href="http://mxr.mozilla.org/mozilla2.0/source/layout/style/nsCSSDataBlock.h#219" rel="noreferrer"><code>source/layout/style/nsCSSDataBlock.h#219</code></a></strong></p> <pre><code> /** * Transfer the state for |aPropID| (which may be a shorthand) * from |aFromBlock| to this block. The property being transferred * is !important if |aIsImportant| is true, and should replace an * existing !important property regardless of its own importance * if |aOverrideImportant| is true. * * ... */ </code></pre> <hr> <blockquote> <ol> <li><p>Firefox uses a top down parser written manually. In both cases each CSS file is parsed into a StyleSheet object, each object contains CSS rules.</p></li> <li><p>Firefox then creates style context trees which contain the end values (after applying all rules in the right order)</p></li> </ol> </blockquote> <p><img src="https://i.stack.imgur.com/OE5Gq.png" alt="CSS Parser Firefox"></p> <p><strong><a href="http://taligarsiel.com/Projects/howbrowserswork1.htm#CSS_parsing" rel="noreferrer">From: http://taligarsiel.com/Projects/howbrowserswork1.htm#CSS_parsing</a></strong></p> <p>Now, you can easily see, in such as case with the Object Model described above, the parser can mark the rules affected by the <code>!important</code> easily, without much of a subsequent cost. Performance degradation <strong>is not</strong> a good argument against <code>!important</code>.</p> <p><strong>However, maintainability does take a hit (as other answers mentioned), which might be your only argument against them.</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload