blob: 51a4ac4c6145a3027d2e7e46ae3f3cbc8c31634d [file] [log] [blame]
This tests verifies that namedItem and named getter returns the first matched item for all but all, options, and form controls collections.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
document.all
PASS document.all instanceof HTMLAllCollection is true
FAIL document.all instanceof HTMLCollection should be true. Was false.
PASS initialLength = document.all.length; elements = [insertElementWithId('b', 'foo'), insertElementWithId('q', 'foo')];
document.all.length is initialLength + 2;
PASS document.all['foo'].length is 2
PASS document.all['foo'][0] is elements[0]
PASS document.all['foo'][1] is elements[1]
PASS elements[0].parentNode.removeChild(elements[0]); document.all['foo'] is elements[1]
form.elements
PASS form.elements instanceof HTMLFormControlsCollection is true
PASS form.elements instanceof HTMLCollection is true
PASS form.elements.length is 0
PASS elements = [createElementWithId('input', 'foo'), createElementWithId('input', 'foo')];
form.appendChild(elements[0]); form.elements.length is 1
PASS form.elements['foo'] is elements[0]
PASS form.appendChild(elements[1]); form.elements.length is 2
PASS form.elements['foo'].toString() is '[object RadioNodeList]'
PASS form.elements['foo'].length is 2
PASS form.elements['foo'][0] is elements[0]
PASS form.elements['foo'][1] is elements[1]
PASS form.removeChild(elements[0]); form.elements['foo'] is elements[1]
PASS removeTestElements(); form.elements.length is 0
select.options
PASS form.appendChild(createElementWithId('select', 'bar')); form.elements.length is 1
PASS select = form.elements[0]; select.options instanceof HTMLOptionsCollection is true
PASS select.options instanceof HTMLCollection is true
PASS select.options.length is 0
PASS elements = [createElementWithId('option', 'foo'), createElementWithId('option', 'foo')];
select.appendChild(elements[0]); select.options.length is 1
PASS select.options['foo'] is elements[0]
PASS select.appendChild(elements[1]); select.options.length is 2
PASS select.options['foo'] is elements[0]
PASS select.removeChild(elements[0]); select.options['foo'] is elements[1]
PASS select.innerHTML = ''; select.options.length is 0
PASS removeTestElements(); form.elements.length is 0
document.images
PASS document.images.length is 0
PASS elements[0] = insertElementWithId('img', 'foo'); document.images.length is 1
PASS elements[1] = insertElementWithId('img', 'foo'); document.images.length is 2
PASS document.images['foo'] is elements[0]
PASS removeTestElements(); document.images.length is 0
document.applets
PASS document.applets.length is 0
PASS elements[0] = insertElementWithId('applet', 'foo'); document.applets.length is 1
PASS elements[1] = insertElementWithId('applet', 'foo'); document.applets.length is 2
PASS document.applets['foo'] is elements[0]
PASS removeTestElements(); document.applets.length is 0
document.embeds
PASS document.embeds.length is 0
PASS elements[0] = insertElementWithId('embed', 'foo'); document.embeds.length is 1
PASS elements[1] = insertElementWithId('embed', 'foo'); document.embeds.length is 2
PASS document.embeds['foo'] is elements[0]
PASS removeTestElements(); document.embeds.length is 0
document.forms
PASS document.forms.length is 1
PASS elements[0] = insertElementWithId('form', 'foo'); document.forms.length is 2
PASS elements[1] = insertElementWithId('form', 'foo'); document.forms.length is 3
PASS document.forms['foo'] is elements[0]
PASS removeTestElements(); document.forms.length is 1
document.links
PASS document.links.length is 0
PASS elements[0] = insertElementWithId('a', 'foo', {"href":"some url"}); document.links.length is 1
PASS elements[1] = insertElementWithId('a', 'foo', {"href":"some url"}); document.links.length is 2
PASS elements[2] = insertElementWithId('area', 'foo', {"href":"some url"}); document.links.length is 3
PASS document.links['foo'] is elements[0]
PASS removeTestElements(); document.links.length is 0
document.anchors
PASS document.anchors.length is 0
PASS elements[0] = insertElementWithId('a', 'foo', {"name":"some name"}); document.anchors.length is 1
PASS elements[1] = insertElementWithId('a', 'foo', {"name":"some name"}); document.anchors.length is 2
PASS document.anchors['foo'] is elements[0]
PASS removeTestElements(); document.anchors.length is 0
document.scripts
PASS document.scripts.length is 2
PASS elements[0] = insertElementWithId('script', 'foo'); document.scripts.length is 3
PASS elements[1] = insertElementWithId('script', 'foo'); document.scripts.length is 4
PASS document.scripts['foo'] is elements[0]
PASS removeTestElements(); document.scripts.length is 2
PASS successfullyParsed is true
TEST COMPLETE