- From: Mike Sherov <mike.sherov@gmail.com>
- Date: Mon, 8 Sep 2014 17:50:57 -0400
- To: Zack Weinberg <zackw@panix.com>
- Cc: Simon Pieters <simonp@opera.com>, www-style list <www-style@w3.org>, "L. David Baron" <dbaron@dbaron.org>
- Message-ID: <CAD1Dv_Lxx5QmiKWQ1cDhcQ-0cJQ00N0jxNvmsQAvMeHkTSUphQ@mail.gmail.com>
On Mon, Sep 8, 2014 at 11:10 AM, Zack Weinberg <zackw@panix.com> wrote: > On Mon, Sep 8, 2014 at 3:32 AM, Simon Pieters <simonp@opera.com> wrote: > > On Mon, 08 Sep 2014 05:19:12 +0200, Mike Sherov <mike.sherov@gmail.com> > > wrote: > >> > >> It seems that in order to change from "color: red !important;" to > "color: > >> black;", one should be able to say "elem.style.color = 'black';" or at > the > >> very least "elem.style.setProperty('color', 'black', '');" > ... > > > > https://www.w3.org/Bugs/Public/show_bug.cgi?id=23066 According to this bug, seems almost everyone was not in favor of this behavior. There was vague mention of further discussion on the ML, with no further link. The problem here is that it's called "setProperty", not "appendProperty". The mental model of "appending an additional rule" is not how anyone I know thinks of this functionality. Most consider it a "set", just like its name, and is accessed via a plain setter. Compound that with the idea that "setPropertyPriority" and "setPropertyValue" DO behave as sets and not appends, and it's very confusing. I'd understand if ".setProperty( property, value )" didn't override "important", but I'm struggling to understand why ".setProperty( property, value, "" )" wouldn't just clear the important flag. There is now no way to change the important flag and value of a property in a single call. > > > > > The idea is that your mental model should be that setProperty('color', > > 'black', '') is equivalent to appending a color:black; declaration to the > > style rule, which doesn't win over the !important one. > > FWIW I still believe quite vehemently that this is wrong, and that > setProperty should behave as Sherov expected. I only dropped the > argument (was that a year ago now? sheesh) because I didn't have time > to pursue it. > > zw > -- Mike Sherov
Received on Monday, 8 September 2014 21:51:46 UTC