Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / w3c / web-platform-tests / shadow-dom / elements-and-dom-objects / shadowroot-object / shadowroot-attributes / activeElement-confirm-return-null.html
1 <!DOCTYPE html>
2 <!-- 
3 Distributed under both the W3C Test Suite License [1] and the W3C
4 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
5 policies and contribution forms [3].
6
7 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
8 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
9 [3] http://www.w3.org/2004/10/27-testcases
10  -->
11 <html>
12 <head>
13 <title>Shadow DOM Test: Confirm activeElement return null</title>
14 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
15 <link rel="author" title="Masaya Iseki" href="mailto:iseki.m.aa@gmail.com">
16 <link rel="help" href="http://w3c.github.io/webcomponents/spec/shadow/#attributes">
17 <meta name="assert" content="ShadowRoot Object: confirm activeElement return null">
18 <script src="../../../../../../resources/testharness.js"></script>
19 <script src="../../../../../../resources/testharnessreport.js"></script>
20 <script src="../../../testcommon.js"></script>
21 <link rel="stylesheet" href="../../../../../../resources/testharness.css">
22 </head>
23 <body>
24 <div id="log"></div>
25 <script>
26 test(unit(function (ctx) {
27
28         var d = newRenderedHTMLDocument(ctx);
29
30         var host = d.createElement('div');
31         d.body.appendChild(host);
32         var s = host.createShadowRoot();
33
34     assert_equals(s.activeElement, null, 'activeElement attribute of the ShadowRoot must return null if there\'s no focused element');
35
36 }), 'confirm activeElement return null');
37
38
39 test(unit(function (ctx) {
40
41         var d = newRenderedHTMLDocument(ctx);
42
43         var host = d.createElement('div');
44         d.body.appendChild(host);
45         var s = host.createShadowRoot();
46
47         var inp = d.createElement('input');
48         d.body.appendChild(inp);
49
50         inp.focus();
51
52     assert_equals(s.activeElement, null, 'activeElement attribute of the ShadowRoot must return null if there\'s no focused element in the shadow tree');
53
54 }), 'confirm activeElement return null when there is other element in body');
55
56
57 test(unit(function (ctx) {
58
59         var d = newRenderedHTMLDocument(ctx);
60
61         var host = d.createElement('div');
62         d.body.appendChild(host);
63         var s = host.createShadowRoot();
64
65         var inp = d.createElement('input');
66         d.body.appendChild(inp);
67
68         var inp2 = d.createElement('input');
69         s.appendChild(inp2);
70
71         inp.focus();
72
73     assert_equals(s.activeElement, null, 'activeElement attribute of the ShadowRoot must return null if there\'s no focused element in the shadow tree');
74
75 }), 'confirm activeElement return null when focus on the element in the outer shadow tree');
76 </script>
77 </body>
78 </html>