W3C home > Mailing lists > Public > www-style@w3.org > August 2013

RE: CSSStyleDeclaration: Setting only a value or a priority

From: Peter Sloetjes <pjs.nl@live.com>
Date: Thu, 15 Aug 2013 23:22:07 +0200
Message-ID: <DUB119-W40B6B1DFE40E88D54A313CE6460@phx.gbl>
To: Simon Sapin <simon.sapin@exyr.org>, "www-style@w3.org" <www-style@w3.org>, "simonp@opera.com" <simonp@opera.com>
In answer to Simon Pieters (15/08/2013 21:30) and Simon Sapin (Thu, 15 Aug 2013 21:34:34 +0100):

Resuming: Three solutions were mentioned in the discussion, all of which are acceptable to me:

1) Omission of priority argument leaves priority unchanged: Makes more sense than the current behavior. Potential compatibility issues, but the spec until recently required the third argument to setProperty, so there shouldn't be too many users that rely on its omission to have any other effect than to leave alone the default value "".
2) Providing "unchanged" as third argument: clear, but leads to additional string argument parsing.
3) Adding a "setPropertyValue" function to the spec: no compatibility issues, slightly faster, clear meaning, symmetric to "getPropertyValue".

For me it's hard to decide without knowing actual implementations, and it's not for me to decide anyway :).

Peter Sloetjes, Firefox add-on developer.

> Date: Thu, 15 Aug 2013 21:34:34 +0100
> From: simon.sapin@exyr.org
> To: www-style@w3.org
> Subject: Re: CSSStyleDeclaration: Setting only a value or a priority
> Le 15/08/2013 21:30, Simon Pieters a écrit :
> >> 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.
> A variant of this without the compat risk to to trigger the new behavior 
> when the priority argument is the string "unchanged", or something else 
> unlikely to occur in existing content.
> -- 
> Simon Sapin
Received on Thursday, 15 August 2013 21:25:55 UTC

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