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

Unified Diff: LayoutTests/fast/css/style-scoped/style-scoped-set-scoped.html

Issue 317143002: Revert of Remove scoped styles. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/css/style-scoped/style-scoped-set-scoped.html
diff --git a/LayoutTests/fast/css/style-scoped/style-scoped-set-scoped.html b/LayoutTests/fast/css/style-scoped/style-scoped-set-scoped.html
new file mode 100644
index 0000000000000000000000000000000000000000..9a478ac113191b5620b66537efc2ca2fa5ab7237
--- /dev/null
+++ b/LayoutTests/fast/css/style-scoped/style-scoped-set-scoped.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script type="text/javascript">
+ function log(msg)
+ {
+ document.getElementById('console').appendChild(document.createTextNode(msg + '\n'));
+ }
+
+ function test(id)
+ {
+ var elem = document.getElementById(id);
+ log(id + ': ' + document.defaultView.getComputedStyle(elem, null).getPropertyValue('color'));
+ }
+
+ function testAll()
+ {
+ test('S1');
+ test('P1');
+ test('R1');
+ test('S2');
+ test('P2');
+ test('R2');
+ test('S3');
+ test('P3');
+ test('R3');
+ }
+
+ function runTests()
+ {
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ log('--- ORIGINAL ---');
+ testAll();
+
+ log('--- AFTER SETTING @SCOPED ---');
+ document.getElementById('STYLE').setAttribute('scoped', true);
+ setTimeout(function() {
+ testAll();
+ log('--- FINISHED ---');
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }, 0);
+ }
+ </script>
+ <style type="text/css" scoped>
+ body { color: black; }
+ </style>
+</head>
+<body onload="runTests();">
+ <p>Test setting the 'scoped' attribute on a &lt;style&gt; element</p>
+ <div>
+ <span id="S1">Text</span>
+ <p id="P1">Text</p>
+ <pre id="R1">Text</p>
+ </div>
+ <div>
+ <style id="STYLE" type="text/css">
+ div { color: red; }
+ p { color: green; }
+ p ~ div pre { color: blue; } /* should NOT apply while scoped! */
+ </style>
+ <span id="S2">Text</span>
+ <p id="P2">Text</p>
+ <pre id="R2">Text</p>
+ </div>
+ <div>
+ <span id="S3">Text</span>
+ <p id="P3">Text</p>
+ <pre id="R3">Text</p>
+ </div>
+ <pre id="console"></pre>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698