Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / label / labels-owner-node-adopted.html
blobd3add9e60677fc59c603e04f13b877a59f0709b4
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>
12 var form = document.querySelector('form');
13 var input = document.querySelector('input');
15 var iframe = document.createElement('iframe');
16 document.body.appendChild(iframe);
17 var labels, label0, label1;
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.")
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");
30 form.style.display = 'none';
32 var successfullyParsed = true;
34 </script>
35 </body>
36 </html>