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_08_02_01</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-fo
rms"> |
| 16 <meta name="assert" content="HTML Elements in shadow trees: Form elements and fo
rm-associated elements in shadow tree are not accessible using document DOM obje
ct's tree accessors"> |
| 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 form-associated elements |
| 26 test(function () { |
| 27 var d = newHTMLDocument(); |
| 28 |
| 29 var form = d.createElement('form'); |
| 30 form.setAttribute('id', 'form_id'); |
| 31 d.body.appendChild(form); |
| 32 |
| 33 var div = d.createElement('div'); |
| 34 d.body.appendChild(div); |
| 35 var s = div.createShadowRoot(); |
| 36 |
| 37 |
| 38 HTML5_FORM_ASSOCIATED_ELEMENTS.forEach(function (tagName) { |
| 39 |
| 40 var el = d.createElement(tagName); |
| 41 el.setAttribute('form', 'form_id'); |
| 42 el.setAttribute('id', tagName + '_id'); |
| 43 s.appendChild(el); |
| 44 |
| 45 assert_equals(d.querySelector('#' + tagName + '_id'), null, 'Form-associ
ated element ' + tagName + |
| 46 ' in shadow tree must not be accessible using owner\'s document
tree accessors'); |
| 47 }); |
| 48 }, 'A_08_02_01_T01'); |
| 49 |
| 50 |
| 51 //test form elements |
| 52 test(function () { |
| 53 var d = newHTMLDocument(); |
| 54 |
| 55 var form = d.createElement('form'); |
| 56 d.body.appendChild(form); |
| 57 |
| 58 var div = d.createElement('div'); |
| 59 form.appendChild(div); |
| 60 s = div.createShadowRoot(); |
| 61 |
| 62 HTML5_FORM_ASSOCIATED_ELEMENTS.forEach(function (tagName) { |
| 63 |
| 64 var el = d.createElement(tagName); |
| 65 el.setAttribute('id', tagName + '_id'); |
| 66 s.appendChild(el); |
| 67 |
| 68 assert_equals(d.querySelector('#' + tagName + '_id'), null, 'Form elemen
t ' + tagName + |
| 69 ' in shadow tree must not be accessible using owner\'s document
tree accessors'); |
| 70 }); |
| 71 }, 'A_08_02_01_T02'); |
| 72 </script> |
| 73 </body> |
| 74 </html> |
OLD | NEW |