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 a
PASS form.originalB is b
PASS form.second is b
PASS form.third is a
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 we still remember names we should

PASS form.thisWillBeForgotten is undefined
PASS form.thisWillBeForgottenToo is undefined
PASS form.thisWillBeRemembered is a
PASS form.thisWillBeRememberedToo is a

PASS successfullyParsed is true

TEST COMPLETE

