Last Comment Bug 903239 - No way to avoid having to set priority of style properties
: No way to avoid having to set priority of style properties
Status: REOPENED
:
Product: Core
Classification: Components
Component: DOM: CSS Object Model (show other bugs)
: 24 Branch
: Other Other
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-08 20:12 PDT by Peter J. Sloetjes
Modified: 2013-09-05 21:22 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
part 1. Change the XPCOM CSSStyleDeclaration::SetProperty to forward to the WebIDL version, instead of vice versa. (11.16 KB, patch)
2013-08-21 14:14 PDT, Boris Zbarsky [:bz] (Out June 25-July 6)
no flags 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 (11.90 KB, patch)
2013-08-21 14:15 PDT, Boris Zbarsky [:bz] (Out June 25-July 6)
dbaron: superreview-
Details | Diff | Review

Description Peter J. Sloetjes 2013-08-08 20:12:18 PDT
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).
Comment 1 Boris Zbarsky [:bz] (Out June 25-July 6) 2013-08-08 21:39:44 PDT
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.
Comment 2 Peter J. Sloetjes 2013-08-09 04:17:59 PDT
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).
Comment 3 Boris Zbarsky [:bz] (Out June 25-July 6) 2013-08-09 06:00:29 PDT
> 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.
Comment 4 Peter J. Sloetjes 2013-08-10 15:41:38 PDT
I have brought the issue up on www-style@w3.org - hopefully it will turn up in a new spec some day.
Comment 5 Peter J. Sloetjes 2013-08-21 12:55:10 PDT
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.
Comment 6 Boris Zbarsky [:bz] (Out June 25-July 6) 2013-08-21 14:14:41 PDT
Created attachment 793694 [details] [diff] [review]
part 1.  Change the XPCOM CSSStyleDeclaration::SetProperty to forward to the WebIDL version, instead of vice versa.
Comment 7 Boris Zbarsky [:bz] (Out June 25-July 6) 2013-08-21 14:15:13 PDT
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
Comment 8 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2013-08-21 14:37:21 PDT
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.
Comment 9 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2013-08-21 14:37:45 PDT
s/mode/model/
Comment 10 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2013-08-21 14:48:04 PDT
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.

Note You need to log in before you can comment on or make changes to this bug.