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 verify HTMLPropertiesCollection and PropertyNodeList interf
aces behavior on changing id attribute."); | |
10 | |
11 var parent = createElement('div', {}, '<div itemprop="foo"><div itemprop="bar"><
/div></div><div itemscope itemref="id1"></div>'); | |
12 var item = parent.childNodes[1]; | |
13 document.body.appendChild(parent); | |
14 | |
15 shouldBe("item.properties.length", "0"); | |
16 shouldBeNull("item.properties.item(0)"); | |
17 shouldBeUndefined("item.properties[0]"); | |
18 shouldBe("item.properties.namedItem('foo').length", "0"); | |
19 shouldBeNull("item.properties.namedItem('foo').item(0)"); | |
20 shouldBeUndefined("item.properties.namedItem('foo')[0]"); | |
21 shouldBe("item.properties.namedItem('bar').length", "0"); | |
22 shouldBeNull("item.properties.namedItem('bar').item(0)"); | |
23 shouldBeUndefined("item.properties.namedItem('bar')[0]"); | |
24 shouldBe("item.properties.names.length", "0"); | |
25 shouldBeNull("item.properties.names.item(0)"); | |
26 shouldBeUndefined("item.properties.names[0]"); | |
27 | |
28 debug(""); | |
29 debug("Set parent.firstChild.id to 'id1'"); | |
30 parent.firstChild.id = 'id1'; | |
31 shouldBe("item.properties.length", "2"); | |
32 shouldBe("item.properties.item(0)", "parent.firstChild"); | |
33 shouldBe("item.properties[0]", "parent.firstChild"); | |
34 shouldBe("item.properties.item(1)", "parent.firstChild.firstChild"); | |
35 shouldBe("item.properties[1]", "parent.firstChild.firstChild"); | |
36 shouldBe("item.properties.namedItem('foo').length", "1"); | |
37 shouldBe("item.properties.namedItem('foo').item(0)", "parent.firstChild"); | |
38 shouldBe("item.properties.namedItem('foo')[0]", "parent.firstChild"); | |
39 shouldBe("item.properties.namedItem('bar').length", "1"); | |
40 shouldBe("item.properties.namedItem('bar').item(0)", "parent.firstChild.firstChi
ld"); | |
41 shouldBe("item.properties.namedItem('bar')[0]", "parent.firstChild.firstChild"); | |
42 shouldBe("item.properties.names.length", "2"); | |
43 shouldBe("item.properties.names.item(0)", "'foo'"); | |
44 shouldBe("item.properties.names[0]", "'foo'"); | |
45 shouldBe("item.properties.names.item(1)", "'bar'"); | |
46 shouldBe("item.properties.names[1]", "'bar'"); | |
47 | |
48 debug(""); | |
49 debug("Remove id attribute from parent.firstChild"); | |
50 parent.firstChild.removeAttribute('id'); | |
51 shouldBe("item.properties.length", "0"); | |
52 shouldBeNull("item.properties.item(0)"); | |
53 shouldBeUndefined("item.properties[0]"); | |
54 shouldBe("item.properties.namedItem('foo').length", "0"); | |
55 shouldBeNull("item.properties.namedItem('foo').item(0)"); | |
56 shouldBeUndefined("item.properties.namedItem('foo')[0]"); | |
57 shouldBe("item.properties.namedItem('bar').length", "0"); | |
58 shouldBeNull("item.properties.namedItem('bar').item(0)"); | |
59 shouldBeUndefined("item.properties.namedItem('bar')[0]"); | |
60 shouldBe("item.properties.names.length", "0"); | |
61 shouldBeNull("item.properties.names.item(0)"); | |
62 shouldBeUndefined("item.properties.names[0]"); | |
63 </script> | |
64 <script src="../../js/resources/js-test-post.js"></script> | |
65 </body> | |
66 </html> | |
OLD | NEW |