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].
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
13 <title>Shadow DOM Test: A_08_02_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/#inert-html-elements">
16 <meta name="assert" content="HTML Elements in shadow trees: form should submit elements in shadow tree">
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">
25 var A_08_02_03_T01 = async_test('A_08_02_03_T01', { timeout: 5000 });
27 A_08_02_03_T01.checkIframeContent = A_08_02_03_T01.step_func(function () {
28 //remember value to check before cleaning the context (it'll destroy the iframe)
29 var valueToCheck = A_08_02_03_T01.iframe.contentWindow.document.URL;
30 cleanContext(A_08_02_03_T01.ctx);
32 assert_true(valueToCheck.indexOf('inp1=value1') > 0,
33 'html form should submit all of its fields');
35 // Expected behavior is not quite clear. See https://www.w3.org/Bugs/Public/show_bug.cgi?id=20320
36 assert_true(valueToCheck.indexOf('inp2=value2') > 0,
37 'html form should submit all of its fields including the shadow ones');
39 A_08_02_03_T01.done();
43 A_08_02_03_T01.step(function () {
45 A_08_02_03_T01.ctx = newContext();
46 var d = newRenderedHTMLDocument(A_08_02_03_T01.ctx);
49 var iframe = document.createElement('iframe');
51 iframe.src = '../../resources/blank.html';
52 iframe.setAttribute('name', 'targetIframe');
53 d.body.appendChild(iframe);
55 A_08_02_03_T01.iframe = iframe;
58 var form = d.createElement('form');
59 form.setAttribute('target', 'targetIframe');
60 form.setAttribute('method', 'GET');
61 form.setAttribute('action', '../../resources/blank.html');
62 d.body.appendChild(form);
65 var root = d.createElement('div');
66 form.appendChild(root);
67 var s = root.createShadowRoot();
70 var input1 = d.createElement('input');
71 input1.setAttribute('type', 'text');
72 input1.setAttribute('name', 'inp1');
73 input1.setAttribute('value', 'value1');
74 form.appendChild(input1);
76 var input2 = d.createElement('input');
77 input2.setAttribute('type', 'text');
78 input2.setAttribute('name', 'inp2');
79 input2.setAttribute('value', 'value2');
80 s.appendChild(input2);
85 // set timeout to give the iframe time to load content
86 setTimeout('A_08_02_03_T01.checkIframeContent()', 2000);