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

RE: objection re: RESOLVED: setProperty's handling of importance logically behaves same as appending a declaraiton (like IE/WebKit)

From: François REMY <francois.remy.dev@outlook.com>
Date: Wed, 11 Sep 2013 18:53:38 +0200
Message-ID: <DUB120-W42A858B91E2E8F3231153EA5390@phx.gbl>
To: Zack Weinberg <zackw@panix.com>, www-style list <www-style@w3.org>
>> RESOLVED: setProperty's handling of importance logically behaves same as appending a declaraiton (like IE/WebKit)

Hi Zack,

I'm not 100% sure I really understood what you meant, but if what you say is that the resolution means that:

    var backup = { value: style.getPropertyValue(prop), priority: style.getPropertyPriority(prop) }
       style.setProperty(prop, tempValue, 'important');
    style.setProperty(prop, backup.value ? backup.value : '', backup.priority);

doesn't work as expected (ie the backup may be restored at important priority) I'm leaning toward the 'bad idea' side.

I'm using this in existing code already, and never noticed any issue with it (most probably because in fact no one use inline style and therefore the latest declaration usually reset the property to its undeclared state, and the inline style wins over any stylesheet in all the remaining cases) but if we've to resolve to a proper behavior here, I would tend to say setProperty should be a shortcut for both setPropertyValue and setPropertyPriority.

I'm at least able to confirm that
    style.setProperty('color', 'blue', 'important')
    style.setProperty('color', '', '')

resets the property in IE which seem to be the reference that has been chosen as the way to go.

As a reminder, the current specification says:
        setProperty: Used to *set* a property value *and* priority within this declaration block.

It seems to me a sane implementation of this sentence does not involve the fiddling with the current values of a property declaration.

If, however, the resolution only applies to the case where the priority is not defined (ie: setProperty(p,v) != setProperty(p,v,'')) then I don't mind, since this is an extension of what's already defined in the spec. Actually, in this specific case I think it even makes sense. If you don't set the priority, the browser can reuse the current one.

PS: By the way, it's usually a bad idea to contest resolutions based on raw notes and not polished minutes, because there are parts of the discussion you cannot see all the details. It would probably have been better to start by asking some clarification before ;-)

Best regards,
Received on Wednesday, 11 September 2013 16:54:06 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:32 UTC