Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / imported / web-platform-tests / shadow-dom / html-elements-in-shadow-trees / inert-html-elements / test-001.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: A_08_01_01</title>
14 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
15 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#inert-html-elements">
16 <meta name="assert" content="HTML Elements in shadow trees: base element must behave as inert, or not part of the document tree">
17 <script src="../../../../../resources/testharness.js"></script>
18 <script src="../../../../../resources/testharnessreport.js"></script>
19 <script src="../../testcommon.js"></script>
20 <link rel="stylesheet" href="../../../../../resources/testharness.css">
21 </head>
22 <body>
23 <div id="log"></div>
24 <script>
25 var A_08_01_01_T01 = async_test('A_08_01_01_T01', { timeout: 5000 });
26
27 A_08_01_01_T01.checkIframeContent = A_08_01_01_T01.step_func(function () {
28         //remember value to check before cleaning the context (it'll destroy the iframe)
29         var valueToCheck = A_08_01_01_T01.iframe.contentWindow;
30         cleanContext(A_08_01_01_T01.ctx);
31
32         assert_equals(valueToCheck, null,
33                 'base html element ih a shadow tree must beahve like inert one');
34
35         A_08_01_01_T01.done();
36 });
37
38
39 A_08_01_01_T01.step(function () {
40
41         A_08_01_01_T01.ctx = newContext();
42     var d = newRenderedHTMLDocument(A_08_01_01_T01.ctx);
43
44     //create iframe
45     var iframe = document.createElement('iframe');
46
47     iframe.src = '../../resources/blank.html';
48     iframe.setAttribute('name', 'targetIframe');
49     d.body.appendChild(iframe);
50
51     A_08_01_01_T01.iframe = iframe;
52
53     // create a link
54     var link = d.createElement('a');
55     link.setAttribute('href', '../../resources/bobs_page.html');
56     link.innerHTML = 'the link';
57     d.body.appendChild(link);
58
59     //create Shadow root
60     var root = d.createElement('div');
61     d.body.appendChild(root);
62     var s = root.createShadowRoot();
63
64     // create base element, set iframe as a target
65     var base = d.createElement('base');
66     base.setAttribute('target', 'targetIframe');
67     s.appendChild(base);
68
69     //click the link
70     link.click();
71
72     //Expected: base should be inert therefore document d
73     // should be reloaded, so iframe context shouldn't be affected
74
75     // set timeout to give the iframe time to load content
76     setTimeout('A_08_01_01_T01.checkIframeContent()', 2000);
77 });
78 </script>
79 </body>
80 </html>