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].
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
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">
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');
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');
37 assert_equals(d.styleSheets.length, initialStyleSheetsCount, 'style elements in shadow DOM must not be exposed via ' +
38 'the document.styleSheets collection ');
40 }, ctx, A_04_01_11_T1));
44 // check that <link> element added to head is not exposed
45 test(unit(function (ctx) {
47 var d = newRenderedHTMLDocument(ctx);
48 var initialStyleSheetsCount = d.styleSheets.length;
50 var link = d.createElement('link');
51 link.setAttribute('href', 'testharness.css');
52 link.setAttribute('rel', 'stylesheet');
53 d.body.appendChild(link);
56 var root = d.createElement('div');
57 d.body.appendChild(root);
58 var s = root.createShadowRoot();
62 assert_equals(d.styleSheets.length, initialStyleSheetsCount, 'stylesheet link elements in shadow DOM must not be ' +
63 'exposed via the document.styleSheets collection');
68 // TODO check selectedStyleSheetSet, lastStyleSheetSet, preferredStyleSheetSet, styleSheetSets