RESOLVED INVALID 9355
!important bug
https://bugs.webkit.org/show_bug.cgi?id=9355
Summary !important bug
Jasper Van Proeyen
Reported 2006-06-08 04:34:40 PDT
In the URL CSS code you will find 2 commented lines that say "weird bug". Bottom-line of the bug: when too much !important overrulings are used, Safari gets quirky on some non-overrulings. E.g: body { margin: 16px 0; } does not have the same effect as body { margin: 16px 0 !importamt; margin: 16px 0; } The first statement should be the correct one, while it's the second that doesn't show the bug (note that both are correct, but the semantics of the first are far better). I've encountered this problem both in Safari 417.9.3 as in the newest nightly build (r14767, Thu Jun 8 3:18:12 GMT 2006) - both Mac OS X 10.4.6.
Attachments
Reduction (468 bytes, text/html)
2006-07-06 16:02 PDT, Mark Rowe (bdash)
no flags
Mark Rowe (bdash)
Comment 1 2006-07-06 05:06:41 PDT
As you have provided only a CSS file and no HTML to apply it to, I am not able to reproduce this bug. A made-up HTML based on the CSS you described does not demonstrate any incorrect behaviour. If you are still experiencing this issue, please provide a URL where the buggy behaviour can seen. HTML used in test: <html><head> <style type="text/css"> body { margin: 16px 0; } </style> </head><body> Text </body></html>
Jasper Van Proeyen
Comment 2 2006-07-06 15:22:08 PDT
I found this bug when I was working on an experimental design for CSS Zen Garden with lots of !important overrulings. The HTML can be found here: http://zen.vanproeyen.be/ The complete CSS here: http://zen.vanproeyen.be/css/sample.css Sorry for not including these URLs the first time.
David Kilzer (:ddkilzer)
Comment 3 2006-07-06 15:37:27 PDT
(In reply to comment #2) > I found this bug when I was working on an experimental design for CSS Zen > Garden with lots of !important overrulings. > > The HTML can be found here: http://zen.vanproeyen.be/ > The complete CSS here: http://zen.vanproeyen.be/css/sample.css Jasper, are you still seeing the problem in the latest nightly WebKit builds? http://nightly.webkit.org/
Mark Rowe (bdash)
Comment 4 2006-07-06 16:02:59 PDT
Created attachment 9240 [details] Reduction I belive that this reduction demonstrates what you are referring to. Applying your example to this reduction, you are asking why #middle div.inner { background-color: red !important; background-color: red; } is different to: #middle div.inner { background-color: red; } The answer is quite simply that !important is taken into consideration in the CSS sort order before the specificity of the selector. While #middle div.inner is more specific than #outer div, the !important rule wins before specificity is even checked. This matches my reading of http://www.w3.org/TR/REC-CSS2/cascade.html#cascading-order, and is consistent with the behaviour of Firefox, at least on Mac OS X.
Joost de Valk (AlthA)
Comment 5 2006-07-07 04:39:26 PDT
I agree with Mark on his conclusion, although i think this is not "worksforme" but just an invalid bug. Sorry :)
Jasper Van Proeyen
Comment 6 2006-07-07 13:05:20 PDT
No problem at all. I'm glad it WASN'T a bug. I should read the W3C documentation more often ;-)
Alexey Proskuryakov
Comment 7 2011-12-07 10:18:42 PST
Actually marking INVALID.
Note You need to log in before you can comment on or make changes to this bug.