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 <p>This test ensures that namedItem must return the correct item properties.</p> | |
9 <div id="console"></div> | |
10 <script> | |
11 var element = createElement('div', {}, '<div itemprop="foo" id="id1"></div><div
itemscope itemref="id2 id1"><div itemprop="foo bar"></div></div><div itemprop="b
az" id="id2"><div itemprop="qux">'); | |
12 var item = element.childNodes[1]; | |
13 document.body.appendChild(element); | |
14 | |
15 debug("<br>Test properties.namedItem(name)."); | |
16 shouldBe("item.properties.namedItem('foo').length", '2'); | |
17 shouldBe("item.properties.namedItem('bar').length", '1'); | |
18 shouldBe("item.properties.namedItem('baz').length", '1'); | |
19 shouldBe("item.properties.namedItem('qux').length", '1'); | |
20 | |
21 shouldBe("item.properties.namedItem('foo')[0]", 'element.firstChild'); | |
22 shouldBe("item.properties.namedItem('foo')[1]", 'item.firstChild'); | |
23 shouldBe("item.properties.namedItem('bar')[0]", 'item.firstChild'); | |
24 shouldBe("item.properties.namedItem('baz')[0]", 'element.lastChild'); | |
25 shouldBe("item.properties.namedItem('qux')[0]", 'element.lastChild.firstChild'); | |
26 | |
27 debug("<br>Test properties[name]."); | |
28 shouldBe("item.properties['foo'].length", '2'); | |
29 shouldBe("item.properties['bar'].length", '1'); | |
30 shouldBe("item.properties['baz'].length", '1'); | |
31 shouldBe("item.properties['qux'].length", '1'); | |
32 | |
33 shouldBe("item.properties['foo'][0]", 'element.firstChild'); | |
34 shouldBe("item.properties['foo'][1]", 'item.firstChild'); | |
35 shouldBe("item.properties['bar'][0]", 'item.firstChild'); | |
36 shouldBe("item.properties['baz'][0]", 'element.lastChild'); | |
37 shouldBe("item.properties['qux'][0]", 'element.lastChild.firstChild'); | |
38 | |
39 debug("<br>Test properties[index]."); | |
40 shouldBe("item.properties[0]", 'element.firstChild'); | |
41 shouldBe("item.properties[1]", 'item.firstChild'); | |
42 shouldBe("item.properties[2]", 'element.lastChild'); | |
43 shouldBe("item.properties[3]", 'element.lastChild.firstChild') | |
44 | |
45 </script> | |
46 <script src="../../js/resources/js-test-post.js"></script> | |
47 </body> | |
48 </html> | |
OLD | NEW |