2 This tests accessing form elements by name. IE only lets you look up names under the first name the element had and does not respond to name changes. Firefox remembers every name item has been accessed with, but forgets items that have not been accessed. This test has been written to expect the Firefox behavior.
4 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
8 PASS form.original is a
9 PASS form.originalB is b
10 PASS form.second is undefined
11 PASS form.third is undefined
12 PASS form.elements.original is a
13 PASS form.elements.originalB is b
14 PASS form.elements.second is undefined
15 PASS form.elements.third is undefined
17 change the form item a's name to thisWillBeRemembered
19 get the variable value through form element
20 PASS form.thisWillBeRemembered is a
22 now change the form item a's name to thisWillBeRememberedToo
23 access it in boolean context
25 accessed form.thisWillBeRememberedToo
27 now change the form item a's name to thisWillBeForgotten
29 get the variable value through collection
30 PASS form.elements.thisWillBeForgotten is a
32 now change the form item a's name to thisWillBeForgottenToo, but don't access it afterwards
34 now change the form item a's name to second
37 PASS form.original is a
38 PASS form.originalB is b
40 PASS form.third is undefined
41 PASS form.elements.original is undefined
42 PASS form.elements.originalB is b
43 PASS form.elements.second is a
44 PASS form.elements.third is undefined
46 now change the form item a's name to third
49 PASS form.original is a
50 PASS form.originalB is b
53 PASS form.elements.original is undefined
54 PASS form.elements.originalB is b
55 PASS form.elements.second is undefined
56 PASS form.elements.third is a
58 now change form item b's name to second
61 PASS form.original is a
62 PASS form.originalB is b
64 PASS form.elements.original is undefined
65 PASS form.elements.originalB is undefined
66 PASS form.elements.second is b
68 now change a form item b's name to third
71 PASS form.original is a
72 PASS form.originalB is b
74 PASS form.third.length is 2
75 PASS form.third[0] is a
76 PASS form.third[1] is b
77 PASS form.elements.original is undefined
78 PASS form.elements.originalB is undefined
79 PASS form.elements.second is undefined
80 PASS form.elements.third.length is 2
81 PASS form.elements.third[0] is a
82 PASS form.elements.third[1] is b
84 now change a form item b's name to fourth
87 PASS form.third.length is undefined
88 PASS form.elements.third is a
89 PASS form.elements.third.length is undefined
94 PASS form.original is undefined.
95 PASS form.originalB is b
97 PASS form.third is undefined.
99 PASS form.elements.original is undefined
100 PASS form.elements.originalB is undefined
101 PASS form.elements.second is undefined
102 PASS form.elements.third is undefined
103 PASS form.elements.fourth is b
105 check that we no longer remember the past names of a
107 PASS form.thisWillBeForgotten is undefined
108 PASS form.thisWillBeForgottenToo is undefined
109 PASS form.thisWillBeRemembered is undefined.
110 PASS form.thisWillBeRememberedToo is undefined.
112 Ensures elements are removed from the past names map of a form element once they are no longer associated with the form element.
113 PASS form1['foo'] is input3
114 PASS form2.appendChild(form1.firstChild); form1['foo'] is undefined.
115 PASS form2['foo'] is input3
116 PASS form2.removeChild(input3); form2['foo'] is undefined.
117 PASS form1.appendChild(input3); form1['foo'] is input3
118 PASS input3.setAttribute('form', 'form1'); form1.removeChild(input3); input3.appendChild(form1); form1['foo'] is undefined.
119 PASS form1['foo'] is not input3
121 Don't add the element from the past names map if we've found elements of the given name.
122 PASS form4['foo'] is form4.childNodes[0]
123 PASS form4['bar'][0] is form4.childNodes[1]
124 PASS form4['bar'][1] is form4.childNodes[2]
125 PASS form4.childNodes[0].name = 'bar'; form4.childNodes[1].name = form4.childNodes[2].name = 'foo'; form4['foo'].length is 2
126 PASS successfullyParsed is true