commit e2d76c2fd44652fdb4ab30c7e7c83fd77351ea31
parent b4948f1713cd7fc56257a9ebf997f96268f5ee3c
Author: Kurt Catti-Schmidt <kschmi@microsoft.com>
Date: Fri, 31 Oct 2025 08:56:49 +0000
Bug 1996962 [wpt PR 55734] - [CSS Modules] Support space-separated specifier list in attribute, a=testonly
Automatic update from web-platform-tests
[CSS Modules] Support space-separated specifier list in attribute
This change adds support for a space-separated list of specifiers in the
shadowrootadoptedstylesheets attribute via SpaceSplitString.
A basic WPT was added that verifies this functionality.
Bug: 448174611
Change-Id: I5b0852ec9dc392378859286621c5f8b178d87687
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7055779
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Kurt Catti-Schmidt <kschmi@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1536833}
--
wpt-commits: 684f38460cd247d79d1c3e0de3925886995585d9
wpt-pr: 55734
Diffstat:
1 file changed, 46 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/shadow-dom/declarative/tentative/shadowrootadoptedstylesheets/shadowrootadoptedstylesheets-multiple.html b/testing/web-platform/tests/shadow-dom/declarative/tentative/shadowrootadoptedstylesheets/shadowrootadoptedstylesheets-multiple.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<title>Multiple specifiers in shadowrootadoptedstylesheets</title>
+<meta name="author" title="Kurt Catti-Schmidt" href="mailto:kschmi@microsoft.com" />
+<link rel='help' href='https://github.com/whatwg/html/pull/11687'>
+<script src='/resources/testharness.js'></script>
+<script src='/resources/testharnessreport.js'></script>
+
+<!-- Use a dataURI + import map so this can be performed in-document. -->
+<script type="importmap">
+{
+ "imports": {
+ "foo": "data:text/css,span {color:blue}",
+ "bar": "data:text/css,span {text-decoration: underline}"
+ }
+}
+</script>
+
+<div id="host">
+ <template shadowrootmode="open" shadowrootadoptedstylesheets="foo bar">
+ <span id="test_element">Test content</span>
+ </template>
+</div>
+
+<script>
+ const host = document.getElementById("host");
+ test(function (t) {
+ assert_equals(
+ host.shadowRoot.adoptedStyleSheets.length,
+ 2,
+ "The shadowrootadoptedstylesheets will declaratively import all space-separated specifiers into the adoptedStyleSheets array.",
+ );
+
+ }, "adoptedStyleSheets is populated from a <template> element's shadowrootadoptedstylesheets attribute.");
+ const test_element = host.shadowRoot.getElementById("test_element");
+
+ test(function (t) {
+ assert_equals(getComputedStyle(test_element)
+ .color, "rgb(0, 0, 255)",
+ "The first specifier's style was applied.");
+ assert_equals(getComputedStyle(test_element)
+ .textDecoration, "underline",
+ "The second specifier's style was applied.");
+
+ }, "Styles from the sheets applied via shadowrootadoptedstylesheets are applied to elements.");
+</script>
+\ No newline at end of file