Files
sousa-gecko/testing/web-platform/tests/css/cssom/StyleSheetList-constructable.html
T
Steinar H. Gunderson c1866ed8a3 Bug 1982019 [wpt PR 54210] - Unify paths for constructing the style sheet list., a=testonly
Automatic update from web-platform-tests
Unify paths for constructing the style sheet list.

We used to have three different ways of constructing the DOM-visible
style sheet list (document.styleSheets), and one of them (the one
for documents) would mistakenly include adopted style sheets as part
of the list. This meant that document.styleSheets could differ
depending on whether we had recently updated RuleSets or not.

Make every path call the existing fast path (the one that only
constructs this list, not RuleSets and such), fixing the problem.
Also, add a test.

Fixed: 437259105
Change-Id: Ida596657053af3a4a380ac5909f9fc6ed011a97d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6832391
Commit-Queue: Steinar H Gunderson <sesse@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Auto-Submit: Steinar H Gunderson <sesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1498720}

--

wpt-commits: ba69c4e1c7de4998a26a0a1c390d95941db1a821
wpt-pr: 54210
2025-08-10 01:16:11 +00:00

25 lines
772 B
HTML

<!DOCTYPE html>
<html>
<head>
<title>CSSOM - StyleSheetList does not include adopted style sheets</title>
<link rel="help" href="https://drafts.csswg.org/cssom/#css-style-sheet-collections">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style id="sheet1">
body { width: 50%; }
</style>
</head>
<body>
<script>
test(() => {
const sheet = new CSSStyleSheet();
document.adoptedStyleSheets = [sheet];
var styleSheets = document.styleSheets;
assert_equals(styleSheets.length, 1);
assert_equals(styleSheets[0], sheet1.sheet);
}, 'document.styleSheets does not include adopted style sheets');
</script>
</body>
</html>