| 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_09_00_04</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/#html-el
    ements-and-their-shadow-trees"> | 
 |  16 <meta name="assert" content="HTML Elements and Their Shadow Trees: Check that de
    tails can contain at least two insertion points with matching criteria 'summary:
    first-of-type' and 'universal selector'"> | 
 |  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 universal selector | 
 |  26 test(unit(function (ctx) { | 
 |  27  | 
 |  28         var d = newRenderedHTMLDocument(ctx); | 
 |  29  | 
 |  30         // create element | 
 |  31     var el = d.createElement('details'); | 
 |  32     el.setAttribute('open', 'open'); | 
 |  33     d.body.appendChild(el); | 
 |  34  | 
 |  35     el.innerHTML = '' + | 
 |  36         '<span id="shadow">This is a node that should be distributed</span>' + | 
 |  37         '<span id="flbk">This is a fallback content</span>'; | 
 |  38  | 
 |  39     var s = el.createShadowRoot(); | 
 |  40     s.innerHTML = '<content select="#shadow"></content>'; | 
 |  41  | 
 |  42     assert_true(d.querySelector('#shadow').offsetTop > 0, '\'details\' should al
    low at least one insertion point'); | 
 |  43     assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shoul
    dn\'t be rendered'); | 
 |  44  | 
 |  45 }), 'A_09_00_04_T01'); | 
 |  46  | 
 |  47  | 
 |  48  | 
 |  49 //test summary:first-of-type | 
 |  50 test(unit(function (ctx) { | 
 |  51  | 
 |  52         var d = newRenderedHTMLDocument(ctx); | 
 |  53  | 
 |  54         // create element | 
 |  55     var el = d.createElement('details'); | 
 |  56     el.setAttribute('open', 'open'); | 
 |  57     d.body.appendChild(el); | 
 |  58  | 
 |  59     el.innerHTML = '' + | 
 |  60         '<summary>' + | 
 |  61         '<span id="shadow">This is a node that should be distributed</span>' + | 
 |  62         '</summary>' + | 
 |  63         '<span id="flbk">Unlucky content</span>'; | 
 |  64  | 
 |  65     var s = el.createShadowRoot(); | 
 |  66     s.innerHTML = '<content select="summary:first-of-type"></content>'; | 
 |  67  | 
 |  68     assert_true(d.querySelector('#shadow').offsetTop > 0, 'details should allow 
    insertion point' + | 
 |  69                 'with summary:first-of-type matching criteria'); | 
 |  70     assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shoul
    dn\'t be rendered'); | 
 |  71  | 
 |  72 }), 'A_09_00_04_T02'); | 
 |  73 </script> | 
 |  74 </body> | 
 |  75 </html> | 
| OLD | NEW |