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>Microdata properties collection must update on adding or removing property.</
p> | |
9 <div id="console"></div> | |
10 <script> | |
11 var element = createElement('div', {itemscope: 'itemscope'}, '<div itemprop="foo
"></div>'); | |
12 | |
13 shouldBeTrue("element.properties.length == '1'"); | |
14 shouldBeTrue("element.properties.item(0) == element.firstChild"); | |
15 shouldBeTrue("element.properties[0] == element.firstChild"); | |
16 | |
17 debug('<br>Append a property with itemprop: bar.'); | |
18 element.appendChild(createElement('div',{itemprop:'bar'})); | |
19 shouldBeTrue("element.properties.length == '2'"); | |
20 shouldBeTrue("element.properties.item(1) == element.childNodes[1]"); | |
21 shouldBeTrue("element.properties[1] == element.childNodes[1]"); | |
22 | |
23 debug('<br>Append a property with itemprop: foo.'); | |
24 element.lastChild.appendChild(createElement('div',{itemprop:'foo'})); | |
25 shouldBeTrue("element.properties.length == '3'"); | |
26 shouldBeTrue("element.properties.item(2) == element.childNodes[1].firstChild"); | |
27 shouldBeTrue("element.properties[2] == element.childNodes[1].firstChild"); | |
28 | |
29 debug('<br>Remove property with itemprop: foo.'); | |
30 element.lastChild.removeChild(element.lastChild.firstChild); | |
31 shouldBeTrue("element.properties.length == '2'"); | |
32 shouldBeTrue("element.properties.item(2) == undefined"); | |
33 shouldBeTrue("element.properties[2] == undefined"); | |
34 | |
35 </script> | |
36 <script src="../../js/resources/js-test-post.js"></script> | |
37 </body> | |
38 </html> | |
OLD | NEW |