| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../js/resources/js-test-pre.js"></script> | |
| 5 <script src="resources/microdata-common.js"></script> | |
| 6 </head> | |
| 7 <body> | |
| 8 <script> | |
| 9 description("Test to ensure that HTMLPropertiesCollection contains all item prop
erties when item is not attached to the DOM tree."); | |
| 10 var parent = createElement('div', {}, '<div itemprop="foo" id="id1"></div><div i
temscope itemref="id1 id2"><div itemprop="bar"></div></div><div itemprop="foo" i
d="id2"><div itemprop="baz"></div></div>'); | |
| 11 var item = parent.childNodes[1]; | |
| 12 | |
| 13 function executeTest() { | |
| 14 shouldBe("item.properties.length", "4"); | |
| 15 shouldBe("item.properties.item(0)", "parent.firstChild"); | |
| 16 shouldBe("item.properties[0]", "parent.firstChild"); | |
| 17 shouldBe("item.properties.item(1)", "item.firstChild"); | |
| 18 shouldBe("item.properties[1]", "item.firstChild"); | |
| 19 shouldBe("item.properties.item(2)", "parent.childNodes[2]"); | |
| 20 shouldBe("item.properties[2]", "parent.childNodes[2]"); | |
| 21 shouldBe("item.properties.item(3)", "parent.childNodes[2].firstChild"); | |
| 22 shouldBe("item.properties[3]", "parent.childNodes[2].firstChild"); | |
| 23 shouldBe("item.properties.names.length", "3"); | |
| 24 shouldBe("item.properties.names.item(0)", "'foo'"); | |
| 25 shouldBe("item.properties.names[0]", "'foo'"); | |
| 26 shouldBe("item.properties.names.item(1)", "'bar'"); | |
| 27 shouldBe("item.properties.names[1]", "'bar'"); | |
| 28 shouldBe("item.properties.names.item(2)", "'baz'"); | |
| 29 shouldBe("item.properties.names[2]", "'baz'"); | |
| 30 shouldBe("item.properties.namedItem('foo').length", "2"); | |
| 31 shouldBe("item.properties.namedItem('foo').item(0)", "parent.firstChild"); | |
| 32 shouldBe("item.properties.namedItem('foo')[0]", "parent.firstChild"); | |
| 33 shouldBe("item.properties.namedItem('foo').item(1)", "parent.childNodes[2]")
; | |
| 34 shouldBe("item.properties.namedItem('foo')[1]", "parent.childNodes[2]"); | |
| 35 shouldBe("item.properties.namedItem('bar').length", "1"); | |
| 36 shouldBe("item.properties.namedItem('bar').item(0)", "item.firstChild"); | |
| 37 shouldBe("item.properties.namedItem('bar')[0]", "item.firstChild"); | |
| 38 shouldBe("item.properties.namedItem('baz').length", "1"); | |
| 39 shouldBe("item.properties.namedItem('baz').item(0)", "parent.childNodes[2].f
irstChild"); | |
| 40 shouldBe("item.properties.namedItem('baz')[0]", "parent.childNodes[2].firstC
hild"); | |
| 41 } | |
| 42 | |
| 43 debug("Item not attached to the dom tree"); | |
| 44 executeTest(); | |
| 45 | |
| 46 document.body.appendChild(parent); | |
| 47 debug(""); | |
| 48 debug("Item added to the dom tree"); | |
| 49 executeTest(); | |
| 50 | |
| 51 document.body.removeChild(parent); | |
| 52 debug(""); | |
| 53 debug("Item detached from the dom tree"); | |
| 54 executeTest(); | |
| 55 </script> | |
| 56 <script src="../../js/resources/js-test-post.js"></script> | |
| 57 </body> | |
| 58 </html> | |
| OLD | NEW |