| 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_10_04_06</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/#content
    -element"> | 
 |  16 <meta name="assert" content="The content HTML element: getDistributedNodes metho
    d"> | 
 |  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  | 
 |  27     var d = newRenderedHTMLDocument(ctx); | 
 |  28  | 
 |  29     d.body.innerHTML = | 
 |  30         '<ul class="cls">' + | 
 |  31             '<li id="li1" class="shadow">1</li>' + | 
 |  32             '<li id="li2" class="shadow2">2</li>' + | 
 |  33             '<li id="li3" class="shadow">3</li>' + | 
 |  34             '<li id="li4">4</li>' + | 
 |  35             '<li id="li5" class="shadow">5</li>' + | 
 |  36             '<li id="li6" class="shadow2">6</li>' + | 
 |  37         '</ul>'; | 
 |  38  | 
 |  39     var host = d.querySelector('.cls'); | 
 |  40     //Shadow root to play with | 
 |  41     var s = host.createShadowRoot(); | 
 |  42  | 
 |  43     var div = d.createElement('div'); | 
 |  44     div.innerHTML = '' + | 
 |  45         '<ul><content id="contentId" select=".clazz"><span id="spandex">This is 
    fallback content</span></content></ul>'; | 
 |  46     s.appendChild(div); | 
 |  47  | 
 |  48     assert_equals(s.querySelector('#contentId').getDistributedNodes().length, 1, | 
 |  49             'Fallback content should show up as distributed nodes'); | 
 |  50  | 
 |  51     assert_equals(s.querySelector('#contentId').getDistributedNodes()[0].id, 'sp
    andex', | 
 |  52             'Fallback content should show up as distributed nodes'); | 
 |  53  | 
 |  54 }), 'A_10_04_06_T01'); | 
 |  55  | 
 |  56  | 
 |  57 test(unit(function (ctx) { | 
 |  58  | 
 |  59     var d = newRenderedHTMLDocument(ctx); | 
 |  60  | 
 |  61     d.body.innerHTML = | 
 |  62         '<ul class="cls">' + | 
 |  63             '<li id="li1" class="shadow">1</li>' + | 
 |  64             '<li id="li2" class="shadow2">2</li>' + | 
 |  65             '<li id="li3" class="shadow">3</li>' + | 
 |  66             '<li id="li4">4</li>' + | 
 |  67             '<li id="li5" class="shadow">5</li>' + | 
 |  68             '<li id="li6" class="shadow2">6</li>' + | 
 |  69         '</ul>'; | 
 |  70  | 
 |  71     var host = d.querySelector('.cls'); | 
 |  72     //Shadow root to play with | 
 |  73     var s = host.createShadowRoot(); | 
 |  74  | 
 |  75     var div = d.createElement('div'); | 
 |  76     div.innerHTML = '' + | 
 |  77         '<ul><content id="contentId" select=".shadow"><span id="spandex">This is
     fallback content</span></content></ul>'; | 
 |  78     s.appendChild(div); | 
 |  79  | 
 |  80     assert_equals(s.querySelector('#contentId').getDistributedNodes().length, 3, | 
 |  81             'Wrond distributed nodes collection size'); | 
 |  82  | 
 |  83     assert_equals(s.querySelector('#contentId').getDistributedNodes()[0].getAttr
    ibute('id'), 'li1', | 
 |  84             'Point 1: wrong element in distributed nodes collection'); | 
 |  85     assert_equals(s.querySelector('#contentId').getDistributedNodes()[1].getAttr
    ibute('id'), 'li3', | 
 |  86         'Point 2: wrong element in distributed nodes collection'); | 
 |  87     assert_equals(s.querySelector('#contentId').getDistributedNodes()[2].getAttr
    ibute('id'), 'li5', | 
 |  88         'Point 3: wrong element in distributed nodes collection'); | 
 |  89  | 
 |  90  | 
 |  91 }), 'A_10_04_06_T02'); | 
 |  92 </script> | 
 |  93 </body> | 
 |  94 </html> | 
| OLD | NEW |