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 document.getItems().length must return the correct num
ber of MicroData Items in the Document. | |
9 <br>Also it tests that document.getItems must return a live NodeList. | |
10 </p> | |
11 | |
12 <div itemscope itemtype="http://example.com/foo" id="one"></div> | |
13 <div itemscope itemtype="http://example.com/bar" id="two"></div> | |
14 <div itemscope itemtype="http://example.com/foo" id="three"> | |
15 <div itemscope itemtype="http://example.com/f1" id="four"></div> | |
16 </div> | |
17 <div id="console"></div> | |
18 <script> | |
19 var one = document.getElementById('one'); | |
20 var two = document.getElementById('two'); | |
21 var three = document.getElementById('three'); | |
22 var four = document.getElementById('four'); | |
23 | |
24 runTest(document.getItems(), [one, two, three, four], "document.getItems() witho
ut aurgument"); | |
25 runTest(document.getItems(''), [one, two, three, four], "document.getItems() wit
h empty string in the aurgument"); | |
26 runTest(document.getItems('http://example.com/foo'), [one, three], "document.get
Items() with 'http://example.com/foo' itemtype in the aurgument"); | |
27 runTest(document.getItems('http://example.com/bar'), [two], "document.getItems()
with 'http://example.com/bar' itemtype in the aurgument"); | |
28 runTest(document.getItems('http://example.com/f1'), [four], "document.getItems()
with 'http://example.com/f1' itemtype in the aurgument"); | |
29 | |
30 var element = createElement('div', {itemscope:'itemscope'}); | |
31 | |
32 // Append newly created item to body | |
33 document.body.appendChild(element); | |
34 runTest(document.getItems(), [one, two, three, four, element], "Newly appended i
tem should be noticed in the NodeList"); | |
35 | |
36 // Remove the element | |
37 document.body.removeChild(element); | |
38 runTest(document.getItems(), [one, two, three, four], "Removing item should be n
oticed in the NodeList"); | |
39 | |
40 </script> | |
41 <script src="../../js/resources/js-test-post.js"></script> | |
42 </body> | |
43 </html> | |
OLD | NEW |