The default bug view has changed. See this FAQ.

No way to avoid having to set priority of style properties

REOPENED
Unassigned

Status

()

Core
DOM: CSS Object Model
REOPENED
4 years ago
4 years ago

People

(Reporter: Peter J. Sloetjes, Unassigned)

Tracking

24 Branch
Other
Other
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

4 years ago
User Agent: Mozilla/5.0 (masking-agent; rv:17.0) Gecko/17.0 Firefox/17.0 (Nightly/Aurora)
Build ID: 20130804004006

Steps to reproduce:

It is not possible to set a CSSStyleDeclaration property value without setting its property priority. To retrieve this priority an additional function call is normally needed.



Actual results:

The current situation leads to unnecessarily slow low level style transformations in cases where only the property values need to be changed.


Expected results:

For symmetry and speed, the CSSStyleDeclaration interface should be extended with the functions 'setPropertyValue' and 'setPropertyPriority'. (Don't remind me that www.w3.org does not specify these - the point is that they should have).
I recommend mailing www-style@w3.org and making the suggestion there.  Yes, I know you said to not remind you, but that's the right venue for suggesting additions to the behavior here.
(Reporter)

Comment 2

4 years ago
Yes, that is the right venue, it just takes one to ten years that way. My recommendation for Mozilla would be to go on pushing for DOM improvements, because its methods can be fast since they are native. (Or perhaps we should be drawing our web content directly on a canvas in order to avoid the DOM altogether).
> it just takes one to ten years that way

It takes as long as UAs will take to implement.

We do not plan to unilaterally ship things like this without coordinating with other UA vendors to make sure they plan to ship as well, so we'd have to bring it up on www-style no matter what.  You're better positioned than I am to do it, because any such discussion will ask for specific use cases, and presumably you have some.
(Reporter)

Comment 4

4 years ago
I have brought the issue up on www-style@w3.org - hopefully it will turn up in a new spec some day.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → WONTFIX
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: WONTFIX → ---
(Reporter)

Comment 5

4 years ago
The Editor's Draft at http://dev.w3.org/csswg/cssom/ has been changed in response to my requests. It now reads:

> If priority is not specified, let priority action be "leave as is". 

Acceptance of the new spec will resolve this bug.
Created attachment 793694 [details] [diff] [review]
part 1.  Change the XPCOM CSSStyleDeclaration::SetProperty to forward to the WebIDL version, instead of vice versa.
Attachment #793694 - Flags: review?(cam)
Assignee: nobody → bzbarsky
Created attachment 793695 [details] [diff] [review]
part 2.  Make the priority argument to CSSStyleDeclaration.setProperty optional, and treat lack of the argument as preserving the current priority.   s
Attachment #793695 - Flags: review?(cam)
Attachment #793695 - Flags: superreview?(dbaron)
I think this is crazy.  The mental mode of setProperty() is equivalent to appending a declaration to the end of the declaration block.  Preserving !important is an obscure use case, and we shouldn't add this footgun.
s/mode/model/
Comment on attachment 793695 [details] [diff] [review]
part 2.  Make the priority argument to CSSStyleDeclaration.setProperty optional, and treat lack of the argument as preserving the current priority.   s

Also, having asemantic difference between omission andempty string is a really bad idea and likely to confuse authors.
Attachment #793695 - Flags: superreview?(dbaron) → superreview-
Attachment #793694 - Flags: review?(cam)
Attachment #793695 - Flags: review?(cam)
Assignee: bzbarsky → nobody
You need to log in before you can comment on or make changes to this bug.