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.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS form.length is 2
PASS form.original is a
PASS form.originalB is b
PASS form.second is undefined
PASS form.third is undefined
PASS form.elements.original is a
PASS form.elements.originalB is b
PASS form.elements.second is undefined
PASS form.elements.third is undefined
change the form item a's name to thisWillBeRemembered
get the variable value through form element
PASS form.thisWillBeRemembered is a
now change the form item a's name to thisWillBeRememberedToo
access it in boolean context
accessed form.thisWillBeRememberedToo
now change the form item a's name to thisWillBeForgotten
get the variable value through collection
PASS form.elements.thisWillBeForgotten is a
now change the form item a's name to thisWillBeForgottenToo, but don't access it afterwards
now change the form item a's name to second
PASS form.length is 2
PASS form.original is a
PASS form.originalB is b
PASS form.second is a
PASS form.third is undefined
PASS form.elements.original is undefined
PASS form.elements.originalB is b
PASS form.elements.second is a
PASS form.elements.third is undefined
now change the form item a's name to third
PASS form.length is 2
PASS form.original is a
PASS form.originalB is b
PASS form.second is a
PASS form.third is a
PASS form.elements.original is undefined
PASS form.elements.originalB is b
PASS form.elements.second is undefined
PASS form.elements.third is a
now change form item b's name to second
PASS form.length is 2
PASS form.original is a
PASS form.originalB is b
PASS form.second is b
PASS form.elements.original is undefined
PASS form.elements.originalB is undefined
PASS form.elements.second is b
now change a form item b's name to third
PASS form.length is 2
PASS form.original is a
PASS form.originalB is b
PASS form.second is b
PASS form.third.length is 2
PASS form.third[0] is a
PASS form.third[1] is b
PASS form.elements.original is undefined
PASS form.elements.originalB is undefined
PASS form.elements.second is undefined
PASS form.elements.third.length is 2
PASS form.elements.third[0] is a
PASS form.elements.third[1] is b
now change a form item b's name to fourth
PASS form.third is a
PASS form.third.length is undefined
PASS form.elements.third is a
PASS form.elements.third.length is undefined
now remove element a
PASS form.length is 1
PASS form.original is undefined.
PASS form.originalB is b
PASS form.second is b
PASS form.third is undefined.
PASS form.fourth is b
PASS form.elements.original is undefined
PASS form.elements.originalB is undefined
PASS form.elements.second is undefined
PASS form.elements.third is undefined
PASS form.elements.fourth is b
check that we no longer remember the past names of a
PASS form.thisWillBeForgotten is undefined
PASS form.thisWillBeForgottenToo is undefined
PASS form.thisWillBeRemembered is undefined.
PASS form.thisWillBeRememberedToo is undefined.
Ensures elements are removed from the past names map of a form element once they are no longer associated with the form element.
PASS form1['foo'] is input3
PASS form2.appendChild(form1.firstChild); form1['foo'] is undefined.
PASS form2['foo'] is input3
PASS form2.removeChild(input3); form2['foo'] is undefined.
PASS form1.appendChild(input3); form1['foo'] is input3
PASS input3.setAttribute('form', 'form1'); form1.removeChild(input3); input3.appendChild(form1); form1['foo'] is undefined.
PASS form1['foo'] is not input3
Don't add the element from the past names map if we've found elements of the given name.
PASS form4['foo'] is form4.childNodes[0]
PASS form4['bar'][0] is form4.childNodes[1]
PASS form4['bar'][1] is form4.childNodes[2]
PASS form4.childNodes[0].name = 'bar'; form4.childNodes[1].name = form4.childNodes[2].name = 'foo'; form4['foo'].length is 2
PASS successfullyParsed is true
TEST COMPLETE