Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / forms / label / labels-owner-node-adopted.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <form>
5 <label id="label1" for="input">label1</label>
6 <label id="label2" for="input">label2</label>
7 <input id="input" type="text">
8 </form>
9 <script src="../../../resources/js-test.js"></script>
10 <script>
11
12 var form = document.querySelector('form');
13 var input = document.querySelector('input');
14
15 var iframe = document.createElement('iframe');
16 document.body.appendChild(iframe);
17 var labels, label0, label1;
18
19 description("This tests moving a node with labels property from one document to another.\n"
20     + "The labels node list should be updated when labels are modified in the new document.")
21
22 debug('The input element initially have two label elements #label1 and #label2.');
23 shouldBe("labels = input.labels; labels.length", "2");
24 shouldBe("label0 = labels[0]; label1 = labels[1]; iframe.contentDocument.body.appendChild(form); labels.length; label1.parentNode.removeChild(label1); labels.length", "1");
25 shouldBe("labels[0]", "label0");
26 shouldBe("label0.parentNode.appendChild(label1); labels.length", "2");
27 shouldBe("labels[0]", "label0");
28 shouldBe("labels[1]", "label1");
29
30 form.style.display = 'none';
31
32 var successfullyParsed = true;
33
34 </script>
35 </body>
36 </html>