OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script src="../../js/resources/js-test-pre.js"></script> | |
4 <script src="resources/microdata-common.js"></script> | |
5 </head> | |
6 <body> | |
7 <script> | |
8 description("Test to ensure that item with itemprop attribute should not include
itself in its HTMLPropetiesCollection."); | |
9 | |
10 var parent = createElement('div', {itemscope: 'itemscope'}, '<div itemscope item
prop="foo"><div itemprop="bar"></div></div>'); | |
11 var item = parent.firstChild; | |
12 | |
13 function executeTest() | |
14 { | |
15 shouldBe("item.properties.length", "1"); | |
16 shouldBe("item.properties.item(0)", "item.firstChild"); | |
17 shouldBe("item.properties[0]", "item.firstChild"); | |
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", "1"); | |
22 shouldBe("item.properties.namedItem('bar').item(0)", "item.firstChild"); | |
23 shouldBe("item.properties.namedItem('bar')[0]", "item.firstChild"); | |
24 shouldBe("item.properties.names.length", "1"); | |
25 shouldBeFalse("item.properties.names.contains('foo')"); | |
26 shouldBeTrue("item.properties.names.contains('bar')"); | |
27 shouldBe("item.properties.names.item(0)", "'bar'"); | |
28 shouldBe("item.properties.names[0]", "'bar'"); | |
29 } | |
30 | |
31 debug(""); | |
32 debug("Item not attached to dom tree"); | |
33 executeTest(); | |
34 | |
35 debug(""); | |
36 debug("Attached item to dom tree"); | |
37 document.body.appendChild(parent); | |
38 executeTest(); | |
39 </script> | |
40 <script src="../../js/resources/js-test-post.js"></script> | |
41 </body> | |
42 </html> | |
OLD | NEW |