Skip to content

Commit

Permalink
Reapply style after a moveBefore
Browse files Browse the repository at this point in the history
The style's render-blocking status should be preserved when it is moved,
but the style must be un-applied and re-applied, as the location of the style in the DOM has significance.

Bug: 394380744

[email protected]

Change-Id: I26404c40bd58f36c8b7e205533c8d3328e21fe24
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6304605
Reviewed-by: Dominic Farolino <[email protected]>
Commit-Queue: Noam Rosenthal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1427964}
  • Loading branch information
noamr authored and chromium-wpt-export-bot committed Mar 4, 2025
1 parent 111d8c7 commit c83d2d6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions dom/nodes/moveBefore/tentative/style-applies.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<body>
</body>
<script>
'use strict';

promise_test(async t => {
const link = document.createElement("link");
link.href = "data:text/css,body{background: green}";
link.rel = "stylesheet";
t.add_cleanup(() => link.remove());
document.body.append(link);
const backgroundColorBefore = getComputedStyle(document.body).backgroundColor;
document.body.moveBefore(link, null);
assert_equals(getComputedStyle(document.body).backgroundColor, backgroundColorBefore);
}, "Moving a style inside the document should not affect whether it's applied");
</script>
</html>

0 comments on commit c83d2d6

Please sign in to comment.