OLD | NEW |
(Empty) | |
| 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_06_00_03</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/#styles"
> |
| 16 <meta name="assert" content="Styles: Each shadow root has an associated list of
zero or more style sheets, named shadow root style sheets"> |
| 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 test(unit(function (ctx) { |
| 26 var d = newRenderedHTMLDocument(ctx); |
| 27 var host = d.createElement('div'); |
| 28 d.body.appendChild(host); |
| 29 |
| 30 //Shadow root to play with |
| 31 var s = host.createShadowRoot(); |
| 32 |
| 33 assert_equals(s.styleSheets.length, 0, 'There should be no style sheets'); |
| 34 }), 'A_06_00_03_T01'); |
| 35 |
| 36 |
| 37 test(unit(function (ctx) { |
| 38 var d = newRenderedHTMLDocument(ctx); |
| 39 var host = d.createElement('div'); |
| 40 host.setAttribute('style', 'width:100px'); |
| 41 d.body.appendChild(host); |
| 42 |
| 43 //Shadow root to play with |
| 44 var s = host.createShadowRoot(); |
| 45 |
| 46 assert_equals(s.styleSheets.length, 0, 'There should be no style sheets'
); |
| 47 }), 'A_06_00_03_T02'); |
| 48 |
| 49 //TODO Now this tests produces an error on Chromium because styleSheets.length |
| 50 //returns 0 when the shadow root is orphaned. |
| 51 //Tracking bug: http://crbug.com/392771 |
| 52 test(unit(function (ctx) { |
| 53 var d = newRenderedHTMLDocument(ctx); |
| 54 var host = d.createElement('div'); |
| 55 |
| 56 //Shadow root to play with |
| 57 var s = host.createShadowRoot(); |
| 58 |
| 59 var style = d.createElement('style'); |
| 60 style.textContent = 'div {width: 50%;}'; |
| 61 s.appendChild(style); |
| 62 |
| 63 // The following line fixes the issue on Chromium, http://crbug.com/392771 |
| 64 // d.body.appendChild(host); |
| 65 assert_equals(s.styleSheets.length, 1, 'Style sheet is not accessible via st
yleSheets'); |
| 66 }), 'A_06_00_03_T03'); |
| 67 </script> |
| 68 </body> |
| 69 </html> |
OLD | NEW |