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

Side by Side Diff: LayoutTests/fast/css/style-scoped/registering-shadowroot.html

Issue 325663003: Remove scoped styles (retry) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix layout test (and expectation) Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../../resources/js-test.js"></script>
4 </head>
5 <body>
6 <p>Test having a &lt;style scoped&gt; element as a direct child of a ShadowR oot.</p>
7 <div id="host">
8 </div>
9 <div id="ref">
10 </div>
11
12 <div id="console"></div>
13
14 <script>
15 if (!window.internals)
16 debug("windows.internals not found!");
17 else if (!window.internals.numberOfScopedHTMLStyleChildren)
18 debug("windows.internals.numberOfScopedHTMLStyleChildren not found!" );
19 else {
20 var ref = document.getElementById('ref');
21 var host = document.getElementById('host');
22 var sr = host.createShadowRoot();
23 var style = document.createElement('style');
24 style.setAttribute('scoped', 'scoped');
25
26 debug("--- Initial ---");
27 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0");
28 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "0"); /* < style> out of document, scoped */
29
30 debug("--- Attaching &lt;style scoped&gt; ---");
31 sr.appendChild(style);
32 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0");
33 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "1"); /* < style> in shadow, scoped */
34
35 debug("--- Removing host ---");
36 host.parentNode.removeChild(host);
37 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0");
38 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "0"); /* < style> out of document, scoped */
39
40 debug("--- Inserting host ---");
41 ref.parentNode.insertBefore(host, ref);
42 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0");
43 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "1"); /* < style> in shadow, scoped */
44
45 debug("--- Unsetting @scoped ---");
46 style.scoped = false;
47 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0");
48 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "1"); /* < style> in shadow, not scoped */
49
50 debug("--- Setting @scoped ---");
51 style.scoped = true;
52 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0");
53 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "1"); /* < style> in shadow, scoped */
54
55 debug("--- Detaching &lt;style scoped&gt; ---");
56 sr.removeChild(style);
57 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "0");
58 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "0"); /* < style> out of document, scoped */
59
60 debug("--- Attaching &lt;style scoped&gt; under host ---");
61 host.appendChild(style);
62 shouldBe("internals.numberOfScopedHTMLStyleChildren(host)", "1");
63 shouldBe("internals.numberOfScopedHTMLStyleChildren(sr)", "0"); /* < style> in tree, scoped */
64
65 debug("--- DONE ---");
66 }
67 var successfullyParsed = true;
68 </script>
69 </body>
70 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698