Closed Bug 1428244 Opened 2 years ago Closed 2 years ago

The attributeChangedCallback for style attribute is always fired with null as oldValue and empty string as newValue

Categories

(Core :: DOM: Core & HTML, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: edgar, Assigned: edgar)

References

Details

Attachments

(2 files)

(See Bug #1419322 comment #14)

This bug is fired to fix
- We are missing [CEReactions] annotation on the attributes of CSSStyleDeclaration [1].
- The attributeChangedCallback for style attribute is always fired with null as oldValue and empty string as newValue [2].

[1] https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-camel-cased-attribute
[2] https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=5663
This also fixes some WPT failures in custom-elements/reactions/CSSStyleDeclaration.html.
Blocks: 1419308
Attachment #8940108 - Flags: review?(bugs)
Attachment #8940109 - Flags: review?(bugs)
Comment on attachment 8940108 [details]
Bug 1428244 - Part 1: Add [CEReactions] in CSSStyleDeclaration;

https://reviewboard.mozilla.org/r/210388/#review216616
Attachment #8940108 - Flags: review?(bugs) → review+
Comment on attachment 8940109 [details]
Bug 1428244 - Part 2: Set correct oldValue/newValue for the attributeChangedCallback which is fired from style attribute change;

https://reviewboard.mozilla.org/r/210390/#review216628

I guess we can do it this way, at least for now.

As I asked on IRC:
edgar: has anyone considered using nsIMutationObserver for CE attribute change notifications
12:19 and using its AttributeWillChange callback
12:19 That is how (DOM) MutationObserver works
Attachment #8940109 - Flags: review?(bugs) → review+
(In reply to Olli Pettay [:smaug] from comment #9)
> has anyone considered using nsIMutationObserver for CE attribute
> change notifications
> 12:19 and using its AttributeWillChange callback
> 12:19 That is how (DOM) MutationObserver works

Not yet, but if it makes implementation simper and less error prone, I am happy doing that :).
Filed bug 1428784.
Pushed by echen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b89800bcb8b9
Part 1: Add [CEReactions] in CSSStyleDeclaration; r=smaug
https://hg.mozilla.org/integration/autoland/rev/ac75fed1265f
Part 2: Set correct oldValue/newValue for the attributeChangedCallback which is fired from style attribute change; r=smaug
https://hg.mozilla.org/mozilla-central/rev/b89800bcb8b9
https://hg.mozilla.org/mozilla-central/rev/ac75fed1265f
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
this wouldn't really solve the style attribute issue, since if we do this, then attribute changes coming from the parser aren't triggered.
er, wrong bug.
You need to log in before you can comment on or make changes to this bug.