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 adding or removing itemref tokens must update i
ts PropertyNodeList."); | |
10 var parent = createElement('div', {}, '<div id="id1" itemprop="foo"></div><div i
temscope></div>'); | |
11 var testElement = parent.childNodes[1]; | |
12 var PNL = testElement.properties.namedItem('foo'); | |
13 | |
14 shouldBe("PNL.length", "0"); | |
15 testElement.itemRef.add('id1'); | |
16 shouldBe("PNL.length", "1"); | |
17 shouldBe("PNL[0]", "parent.firstChild"); | |
18 testElement.itemRef.remove('id1'); | |
19 shouldBe("PNL.length", "0"); | |
20 shouldBeTrue("!PNL[0]"); | |
21 | |
22 document.body.appendChild(parent); | |
23 var length0 = PNL.length; | |
24 testElement.itemRef.toggle('id1'); | |
25 var length1 = PNL.length; | |
26 var foo0 = PNL[0]; | |
27 testElement.removeAttribute('itemref'); | |
28 var length2 = PNL.length; | |
29 var foo1 = PNL[0]; | |
30 document.body.removeChild(parent); | |
31 shouldBe("length0", "0"); | |
32 shouldBe("length1", "1"); | |
33 shouldBe("foo0", "parent.firstChild"); | |
34 shouldBe("length2", "0"); | |
35 shouldBeTrue("!foo1"); | |
36 </script> | |
37 <script src="../../js/resources/js-test-post.js"></script> | |
38 </body> | |
39 </html> | |
OLD | NEW |