Files
sousa-gecko/testing/web-platform/tests/css/cssom/set-selector-text-attachment.html
T
Anders Hartvoll Ruud e38852642f Bug 1948720 [wpt PR 50752] - [cssom] Reattach wrappers during CSSStyleRule::setSelectorText, a=testonly
Automatic update from web-platform-tests
[cssom] Reattach wrappers during CSSStyleRule::setSelectorText

CL:6070884 changed setSelectorText to take a copy of the old rule's
CSSPropertyValueSet, but it didn't actually reattach the CSSOM wrapper
(if any) representing that CSSPropertyValueSet. This caused
the CSSStyleDeclaration object to become "detached", causing no
style invalidation when mutated.

We already have code to carry out such reattachment, so we can fix
the bug by invoking that.

Fixed: 396612327
Change-Id: I10da7bd264286c8af29bbdc33b57ec14eb177cfd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6276187
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1421078}

--

wpt-commits: 3ec9b84e0260aefd6a2d8d6563c241f560cc41aa
wpt-pr: 50752
2025-02-19 08:54:13 +00:00

29 lines
839 B
HTML

<!DOCTYPE html>
<title>Setting selectorText does not detach rule</title>
<link rel="help" href="https://drafts.csswg.org/cssom-1/#dom-cssstylerule-selectortext">
<link rel="help" href="https://issues.chromium.org/issues/396612327">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style id=sheet>
span {
color: black;
}
</style>
<div>
<span id=span>A</span>
</div>
<script>
test(() => {
let rule = sheet.sheet.cssRules[0];
let style = rule.style;
style.color = 'red';
assert_equals(getComputedStyle(span).color, 'rgb(255, 0, 0)');
rule.selectorText = '#span';
style.color = 'green';
assert_equals(getComputedStyle(span).color, 'rgb(0, 128, 0)');
}, 'Modifying property value invalidates style, even after selectorText mutation');
</script>