5 <label id=
"label1" for=
"input">label1
</label>
6 <label id=
"label2" for=
"input">label2
</label>
7 <input id=
"input" type=
"text">
9 <script src=
"../../../resources/js-test.js"></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;