Re: CSSStyleDeclaration: Setting only a value or a priority

On Mon, 12 Aug 2013 21:57:21 +0200, Peter Sloetjes <pjs.nl@live.com> wrote:

>> > For the purpose of faster and simpler low level style  
>> transformations, I
>> > would like to see either:
>> > 1) the CSSStyleDeclaration interface to be extended with the functions
>> > 'setPropertyValue' and 'setPropertyPriority', or
>> > 2)
>> >  the CSSStyleDeclaration.setProperty function to accept 'null' for the
>> > property value or property priority as an indication that the
>> > value/priority should not be changed.
>>
>> For (2), currently null for the value means that the declaration is to  
>> be
>> removed and null for priority means that !important gets unset.

> As you note, the second solution I proposed is not feasible, hence the  
> preferred solution would be to add 'setPropertyValue' and  
> 'setPropertyPriority' functions to the CSSStyleDeclaration interface,  
> for symmetry & speed.

Another option is to let setProperty(value) i.e. with the second argument  
omitted leave the priority alone. This would be a change in behavior, but  
the current behavior seems unexpected and is likely to result in buggy  
code. Does anyone know if there are pages that would break if  
setProperty(value) (or with the property = value; syntax) would *not*  
unset !important ?

Your use case doesn't need setting priority without changing the value, so  
we probably don't need to have a method for doing so.

-- 
Simon Pieters
Opera Software

Received on Thursday, 15 August 2013 20:25:06 UTC