Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / imported / web-platform-tests / shadow-dom / shadow-trees / upper-boundary-encapsulation / test-011.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_04_01_11</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/#upper-boundary-encapsulation">
16 <meta name="assert" content="Upper-boundary encapsulation:The style sheets, represented by the shadow nodes are not accessible using shadow host document's CSSOM extensions">
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 // check that <style> element added to head is not exposed
26 var A_04_01_11_T1 = async_test('A_04_01_11_T01');
27
28 A_04_01_11_T1.step(function () {
29     var ctx = newContext();
30     var iframe = newIFrame(ctx, '../../resources/blank.html');
31     iframe.onload = A_04_01_11_T1.step_func(step_unit(function () {
32         var d = iframe.contentDocument;
33         var initialStyleSheetsCount = d.styleSheets.length;
34         var s = d.head.createShadowRoot();
35         var style = d.createElement('style');
36         s.appendChild(style);
37         assert_equals(d.styleSheets.length, initialStyleSheetsCount, 'style elements in shadow DOM must not be exposed via ' +
38             'the document.styleSheets collection ');
39
40     }, ctx, A_04_01_11_T1));
41 });
42
43
44 // check that <link> element added to head is not exposed
45 test(unit(function (ctx) {
46
47         var d = newRenderedHTMLDocument(ctx);
48         var initialStyleSheetsCount = d.styleSheets.length;
49
50         var link = d.createElement('link');
51         link.setAttribute('href', 'testharness.css');
52         link.setAttribute('rel', 'stylesheet');
53         d.body.appendChild(link);
54
55         //create Shadow root
56         var root = d.createElement('div');
57         d.body.appendChild(root);
58         var s = root.createShadowRoot();
59
60         s.appendChild(link);
61
62         assert_equals(d.styleSheets.length, initialStyleSheetsCount, 'stylesheet link elements in shadow DOM must not be ' +
63             'exposed via the document.styleSheets collection');
64
65
66 }), 'A_04_01_11_T2');
67
68 // TODO check selectedStyleSheetSet, lastStyleSheetSet, preferredStyleSheetSet, styleSheetSets
69 </script>
70 </body>
71 </html>