Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(678)

Unified Diff: third_party/WebKit/LayoutTests/shadow-dom/link.html

Issue 2177163002: Allow <link rel=stylesheet> in a connected shadow tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/shadow-dom/link.html
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/link.html b/third_party/WebKit/LayoutTests/shadow-dom/link.html
new file mode 100644
index 0000000000000000000000000000000000000000..8b1c3329b27afe16154e167dc9f051abfb1fb287
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/shadow-dom/link.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<body>
+ <div id="host"></div>
+ <div id="bodyChild"></div>
+</body>
+<script>
+function colorFor(elem) {
+ return document.defaultView.getComputedStyle(elem, '').color;
+}
+
+async_test((test) => {
+ let link = document.createElement('link');
+ link.setAttribute('rel', 'stylesheet');
+ link.setAttribute('href', 'data:text/css,div { color: green }');
+ link.addEventListener("load", (e) => {
+ test.step(() => {
kochi 2016/07/29 07:10:12 nit: instead of "(e) => { test.step(() => {... tes
hayato 2016/07/29 07:41:56 Done
+ assert_equals(colorFor(bodyChild), 'rgb(0, 0, 0)', 'An element in a document tree should not be styled.');
+ assert_equals(colorFor(shadowChild), 'rgb(0, 128, 0)', 'An element in a shadow tree should be styled.');
+ test.done();
+ });
+ });
+ let sr = host.attachShadow({ mode: 'open' });
+ let shadowChild = document.createElement('div');
+ sr.appendChild(shadowChild);
+ sr.appendChild(link);
+}, '<link rel=stylesheet> should load a stylesheet in a connected shadow tree.');
+</script>

Powered by Google App Engine
This is Rietveld 408576698