Bug 1523562 [wpt PR 14921] - Remove adopted stylesheets when adopting to a different document, a=testonly
authorRakina Zata Amni <rakina@chromium.org>
Thu, 31 Jan 2019 18:56:38 +0000
changeset 458021 bb4af440bf34a125819c106faeb8be867a22ab3f
parent 458020 1b5cd3497783ca32cbf32566891e5219fe2cb8fc
child 458022 14167cb50847a4a6e10317e6e9017c8fe252794b
push id35518
push useropoprus@mozilla.com
push dateFri, 08 Feb 2019 09:55:14 +0000
treeherdermozilla-central@3a3e393396f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1523562, 14921, 807560, 1415068, 623660
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1523562 [wpt PR 14921] - Remove adopted stylesheets when adopting to a different document, a=testonly Automatic update from web-platform-tests Remove adopted stylesheets when adopting to a different document When adopting a subtree to a different document, we'll remove all the adopted stylesheets in that subtree, instead of keeping them and then ignoring them in style calculation. Relevant discussion: https://github.com/WICG/construct-stylesheets/issues/23 Bug: 807560 Change-Id: I7ea6c869892cabd9d3b5a765f26364e51b1419b4 Reviewed-on: https://chromium-review.googlesource.com/c/1415068 Reviewed-by: Rune Lillesveen <futhark@chromium.org> Commit-Queue: Rakina Zata Amni <rakina@chromium.org> Cr-Commit-Position: refs/heads/master@{#623660} -- wpt-commits: 52006fa6b573b044a4940dc7725f7151bfd8b1f9 wpt-pr: 14921
testing/web-platform/tests/css/cssom/CSSStyleSheet-constructable.html
--- a/testing/web-platform/tests/css/cssom/CSSStyleSheet-constructable.html
+++ b/testing/web-platform/tests/css/cssom/CSSStyleSheet-constructable.html
@@ -496,20 +496,23 @@ test(() => {
   const span = document.createElement("span");
   thirdSection.appendChild(span);
   const shadowDiv = attachShadowDiv(span);
   const sheet = new CSSStyleSheet();
   sheet.replaceSync("* { color: red; }");
   span.shadowRoot.adoptedStyleSheets = [sheet];
   assert_equals(getComputedStyle(shadowDiv).color, "rgb(255, 0, 0)");
 
+  document.adoptNode(span);
+  assert_equals(span.shadowRoot.adoptedStyleSheets.length, 1);
+  assert_equals(span.shadowRoot.adoptedStyleSheets[0], sheet);
+
   const iframe = document.createElement("iframe");
   document.body.appendChild(iframe);
   iframe.contentDocument.adoptNode(span);
   iframe.contentDocument.body.appendChild(span);
   assert_not_equals(span.shadowRoot, null);
-  assert_equals(span.shadowRoot.adoptedStyleSheets.length, 1);
-  assert_equals(span.shadowRoot.adoptedStyleSheets[0], sheet);
+  assert_equals(span.shadowRoot.adoptedStyleSheets.length, 0);
   assert_equals(getComputedStyle(shadowDiv).color, "rgb(0, 0, 0)");
-}, 'Adopting a shadow host will move adoptedStyleSheets but it is not applied');
+}, 'Adopting a shadow host will empty adoptedStyleSheets if adopting to a different document');
 
 </script>