W3C home > Mailing lists > Public > www-style@w3.org > September 2014

[cssom] overwriting an important style

From: Mike Sherov <mike.sherov@gmail.com>
Date: Sun, 07 Sep 2014 20:19:12 -0700 (PDT)
Message-Id: <1410146351339.1dbf8fe1@Nodemailer>
To: "www-style list" <www-style@w3.org>
Apologies if I've overlooked something, but it appears from the spec that there is no single method that can be invoked on an elements style declaration to change it from (e.g.) "color: red !important" to "color: black". 

Step 3 of http://dev.w3.org/csswg/cssom/#append-a-css-declaration says: "If declaration has its important flag set and the important flag is not set, terminate these steps."

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', '');"

However, the way the spec is written (and the way all but FF implement), the following is required: "elem.style.setPropertyPriority(''); elem.style.setPropertyValue('black');"

What's the reason for this termination step and not allowing for elem.style.setProperty('color', 'black', ''); to work once the important flag has been set on a declaration?

Can this be changed?
Sent from Mailbox
Received on Monday, 8 September 2014 03:19:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:46 UTC