Closed Bug 1498445 Opened 2 years ago Closed 2 years ago

cssstyledeclaration-mutationrecord-002.html is not testing what it wants to test.

Categories

(Core :: DOM: CSS Object Model, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

It's trying to test that setting an invalid CSS value for a property doesn't fire a mutation record. But the element doesn't have an existing style attribute, and as it turns out that given the following:

let div = document.createElement("div");
div.style.display = "bogus";

div.hasAttribute("style") will be true in Firefox, Blink and Webkit, but false in Edge.

So we do fire a mutation record, but due to the attribute creation, not the mutation.

I think only Edge matches the spec, and I want to update Firefox to do the same, and add another test to test what this wants to test.
Flags: needinfo?(emilio)
Flags: needinfo?(emilio)
This matches Edge, and the spec.

Added an explicit test for this, and a test that tests what
cssstyledeclaration-mutationrecord-002.html wanted to test, which is that
changing an existing declaration doesn't generate a mutation record.
Actually I was testing it wrong, and other browsers are correct here as well. I just happened to test with a page which had a style="" attribute in <body> instead.

So the good news is that this change is even less risky.
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/autoland/rev/ccdfe4ca1f88
Stop creating a style attribute for invalid property values. r=smaug
https://hg.mozilla.org/mozilla-central/rev/ccdfe4ca1f88
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/13494 for changes under testing/web-platform/tests
You need to log in before you can comment on or make changes to this bug.