Closed Bug 1331301 Opened 7 years ago Closed 7 years ago

stylo: Attching new stylesheet via DOM API (rather than CSSOM API) doesn't trigger restyle as expected

Categories

(Core :: CSS Parsing and Computation, defect, P2)

defect

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox53 --- affected

People

(Reporter: xidorn, Unassigned)

References

Details

When mutating stylesheet via DOM API (inserting nodes, etc.) rather than CSSOM API, restyling is not properly triggered. See the following code:
<!DOCTYPE html>
<style>span { color: red; }</style>
<span>test</span>
<script>
setTimeout(() => {
  let t = document.createTextNode('span { color: green; }');
  let e = document.createElement('style');
  e.appendChild(t);
  document.body.appendChild(e);
}, 0);
</script>

Also:
<!DOCTYPE html>
<style>span { color: red; }</style>
<span>test</span>
<script>
setTimeout(() => {
  let t = document.createTextNode('span { color: green; }');
  document.querySelector('style').appendChild(t);
}, 0);
</script>

(I suspect that other things may trigger this issue as well, e.g. removing <style>/<link> element, removing child of <style>, changing src of <link> element etc.)

(This is a failure revealled from layout/style/test/test_bug413958.html)
Another way is to change the content of style element via style.firstChild.data (and probably style.textContent also works).

This failure pattern can be seen in layout/style/test/test_bug534804.html as well, so I suggest this could also be a common pattern among style system tests.
Priority: -- → P2
We believe bug 1328652 may fix this.
Depends on: 1328652
Yes, actually the last failures related to this went with the recent flag fixes and the support for the selectors that were used in the test: https://hg.mozilla.org/integration/autoland/rev/a1ee487645c3
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.