• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1description('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
3var f = document.createElement('form');
4var i = document.createElement('input');
5i.name = 'first';
6i.type = 'text';
7i.value = 'test';
8f.appendChild(i);
9
10shouldBe("i.getAttribute('name')", "'first'");
11shouldBe("i.name", "'first'");
12shouldBe("i.getAttribute('type')", "'text'");
13shouldBe("i.type", "'text'");
14shouldBe("i.value", "'test'");
15shouldBe("f.elements.length", "1");
16shouldBe("f.elements[0]", "i");
17shouldBe("f.elements.first", "i");
18
19f.elements.second;
20i.name = 'second';
21i.type = 'password';
22i.value = 'TEST';
23
24// This has to be the first expression tested, because reporting the result will fix the bug.
25shouldBe("f.elements.second", "i");
26
27shouldBe("i.getAttribute('name')", "'second'");
28shouldBe("i.name", "'second'");
29shouldBe("i.getAttribute('type')", "'password'");
30shouldBe("i.type", "'password'");
31shouldBe("i.value", "'TEST'");
32shouldBe("f.elements.length", "1");
33shouldBe("f.elements[0]", "i");
34shouldBe("f.elements.first", "undefined");
35shouldBe("f.elements.second", "i");
36
37var successfullyParsed = true;
38