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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/Element-interface-shadowRoot-attribute.html

Issue 1192983003: CSS Custom Properties (Variables) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Whoops, the forward declaration just needed to be moved. Created 5 years, 2 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 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Shadow DOM: Element interface shadowRoot attribute</title>
5 <meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
6 <meta name="assert" content="shadowRoot attribute on Element interface must retu rn the associated open shadow tree if there is one">
7 <link rel="help" href="https://w3c.github.io/webcomponents/spec/shadow/#the-shad owroot-interface">
8 <script src="../../../resources/testharness.js"></script>
9 <script src="../../../resources/testharnessreport.js"></script>
10 <link rel='stylesheet' href='../../../resources/testharness.css'>
11 </head>
12 <body>
13 <div id="log"></div>
14 <script>
15
16 test(function () {
17 assert_true('shadowRoot' in Element.prototype, 'shadowRoot must be defined o n Element prototype');
18 assert_true('shadowRoot' in document.createElement('div'), 'shadowRoot must be defined on an instance of div element');
19 assert_false('shadowRoot' in Node.prototype, 'shadowRoot must not be defined on Node prototype');
20 assert_false('shadowRoot' in Text.prototype, 'shadowRoot must not be defined on Text prototype');
21 assert_false('shadowRoot' in document.createTextNode(''), 'shadowRoot must n ot be defined on an instance of Text node');
22 assert_false('shadowRoot' in Comment.prototype, 'shadowRoot must not be defi ned on Comment prototype');
23 assert_false('shadowRoot' in document.createComment(''), 'shadowRoot must no t be defined on an instance of Comment node');
24 assert_false('shadowRoot' in Document.prototype, 'shadowRoot must not be def ined on Document prototype');
25 assert_false('shadowRoot' in document, 'shadowRoot must not be defined on an instance of Document');
26 assert_false('shadowRoot' in DocumentFragment.prototype, 'shadowRoot must no t be defined on DocumentFragment prototype');
27 assert_false('shadowRoot' in (new DOMParser).parseFromString('', 'text/html' ), 'shadowRoot must not be defined on an instance of DocumentFragment node');
28 }, 'shadowRoot must be defined on Element prototype');
29
30 test(function () {
31 var host = document.createElement('div');
32 assert_equals(host.shadowRoot, null, 'shadowRoot must return null when the h ost does not have a shadow tree attached to it');
33
34 var openShadowRoot = host.attachShadow({mode: 'open'});
35 assert_equals(host.shadowRoot, openShadowRoot, 'shadowRoot must return the o pen shadow root attachShadow attached');
36 }, 'shadowRoot attribute must return the open shadow root associated with the el ement');
37
38 test(function () {
39 var host = document.createElement('div');
40 host.attachShadow({mode: 'closed'});
41 assert_equals(host.shadowRoot, null);
42 }, 'shadowRoot attribute must return null if the shadow root attached to the ele ment is closed');
43
44 </script>
45 </body>
46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698