test-003.html (1807B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Shadow DOM Test: A_06_00_03</title> 5 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> 6 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#styles"> 7 <meta name="assert" content="Styles: Each shadow root has an associated list of zero or more style sheets, named shadow root style sheets"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="../../../html/resources/common.js"></script> 11 <script src="../../resources/shadow-dom-utils.js"></script> 12 </head> 13 <body> 14 <div id="log"></div> 15 <script> 16 test(unit(function (ctx) { 17 var d = newRenderedHTMLDocument(ctx); 18 var host = d.createElement('div'); 19 d.body.appendChild(host); 20 21 //Shadow root to play with 22 var s = host.attachShadow({mode: 'open'}); 23 24 assert_equals(s.styleSheets.length, 0, 'There should be no style sheets'); 25 }), 'A_06_00_03_T01'); 26 27 28 test(unit(function (ctx) { 29 var d = newRenderedHTMLDocument(ctx); 30 var host = d.createElement('div'); 31 host.setAttribute('style', 'width:100px'); 32 d.body.appendChild(host); 33 34 //Shadow root to play with 35 var s = host.attachShadow({mode: 'open'}); 36 37 assert_equals(s.styleSheets.length, 0, 'There should be no style sheets'); 38 }), 'A_06_00_03_T02'); 39 40 test(unit(function (ctx) { 41 var d = newRenderedHTMLDocument(ctx); 42 var host = d.createElement('div'); 43 44 //Shadow root to play with 45 var s = host.attachShadow({mode: 'open'}); 46 47 var style = d.createElement('style'); 48 style.textContent = 'div {width: 50%;}'; 49 s.appendChild(style); 50 51 d.body.appendChild(host); 52 assert_equals(s.styleSheets.length, 1, 'Style sheet is not accessible via styleSheets'); 53 }), 'A_06_00_03_T03'); 54 </script> 55 </body> 56 </html>