1 description('Test the elements collection when the form is not a descendant of the document. This test case failed in an early version of Acid3.'); 2 3 var f = document.createElement('form'); 4 var i = document.createElement('input'); 5 i.name = 'first'; 6 i.type = 'text'; 7 i.value = 'test'; 8 f.appendChild(i); 9 10 shouldBe("i.getAttribute('name')", "'first'"); 11 shouldBe("i.name", "'first'"); 12 shouldBe("i.getAttribute('type')", "'text'"); 13 shouldBe("i.type", "'text'"); 14 shouldBe("i.value", "'test'"); 15 shouldBe("f.elements.length", "1"); 16 shouldBe("f.elements[0]", "i"); 17 shouldBe("f.elements.first", "i"); 18 19 f.elements.second; 20 i.name = 'second'; 21 i.type = 'password'; 22 i.value = 'TEST'; 23 24 // This has to be the first expression tested, because reporting the result will fix the bug. 25 shouldBe("f.elements.second", "i"); 26 27 shouldBe("i.getAttribute('name')", "'second'"); 28 shouldBe("i.name", "'second'"); 29 shouldBe("i.getAttribute('type')", "'password'"); 30 shouldBe("i.type", "'password'"); 31 shouldBe("i.value", "'TEST'"); 32 shouldBe("f.elements.length", "1"); 33 shouldBe("f.elements[0]", "i"); 34 shouldBe("f.elements.first", "undefined"); 35 shouldBe("f.elements.second", "i"); 36 37 var successfullyParsed = true; 38