- From: Zack Weinberg <zackw@panix.com>
- Date: Thu, 22 Aug 2013 17:00:45 -0400
- To: Simon Pieters <simonp@opera.com>
- Cc: "L. David Baron" <dbaron@dbaron.org>, "www-style@w3.org" <www-style@w3.org>, Peter Sloetjes <pjs.nl@live.com>
Simon Pieters <simonp@opera.com> wrote: > L. David Baron <dbaron@dbaron.org> wrote: >> Simon Pieters wrote: >>> setProperty with no priority was *not* a no-op in the previous spec. >>> Instead, it would set the value and unset important. This is what >>> Gecko (and Presto) implements also. >>> >>> http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2472 >> >> OK, I guess it was originally implemented that way but changed in >> https://bugzilla.mozilla.org/show_bug.cgi?id=556661 . > > The reporter of that bug clearly has a different mental model about what > setProperty should do. Since that was me ... David, I think you've let the guts of Gecko's implementation color your thinking a little too much. Specifically, the fact that Gecko maintains separate "declaration blocks" for !important and normal properties from the same style rule is an artifact of the implementation that should *not* IMNSHO be visible to style authors. Style authors should be presented a unified view in which any given rule has only one value for any given property, which may or may not have its !important bit set. As such, setProperty(prop, value, "") should be thought of *not* as "appending a new property-value pair to the style rule, which may then override an earlier pair" but as "*replacing* the existing value for 'prop', if any, otherwise setting it anew". I believe this is the most natural mental model. (Relatedly, I think the behavior of p { color: green !important; color; red } is surprising and inconsistent with the rest of CSS, and should probably be changed so the textually-last property clobbers the !important one.) zw
Received on Thursday, 22 August 2013 21:01:07 UTC