OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <script src="../../js/resources/js-test-pre.js"></script> | |
5 </head> | |
6 <body> | |
7 <div itemtype="" id="mydiv"></div> | |
8 <script> | |
9 description("This test verifies itemType[index], itemRef[index], itemProp[index]
behavior for out-of-range index."); | |
10 | |
11 debug("Test itemType[index]"); | |
12 var element = document.getElementById("mydiv"); | |
13 shouldBeNull("element.itemType.item(0)"); | |
14 shouldBeUndefined("element.itemType[0]"); | |
15 element.itemType.add("foo"); | |
16 shouldBeNull("element.itemType.item(1)"); | |
17 shouldBeUndefined("element.itemType[1]"); | |
18 element.itemType.remove("foo"); | |
19 shouldBeNull("element.itemType.item(0)"); | |
20 shouldBeUndefined("element.itemType[0]"); | |
21 //Test with invalid index | |
22 shouldBeNull("element.itemType.item(-1)"); | |
23 shouldBeUndefined("element.itemType[-1]"); | |
24 | |
25 debug("\nTest itemRef[index]"); | |
26 var element = document.getElementById("mydiv"); | |
27 shouldBeNull("element.itemRef.item(0)"); | |
28 shouldBeUndefined("element.itemRef[0]"); | |
29 element.itemRef.add("foo"); | |
30 shouldBeNull("element.itemRef.item(1)"); | |
31 shouldBeUndefined("element.itemRef[1]"); | |
32 element.itemRef.remove("foo"); | |
33 shouldBeNull("element.itemRef.item(0)"); | |
34 shouldBeUndefined("element.itemRef[0]"); | |
35 //Test with invalid index | |
36 shouldBeNull("element.itemRef.item(-1)"); | |
37 shouldBeUndefined("element.itemRef[-1]"); | |
38 | |
39 debug("\nTest itemProp[index]"); | |
40 var element = document.getElementById("mydiv"); | |
41 shouldBeNull("element.itemProp.item(0)"); | |
42 shouldBeUndefined("element.itemProp[0]"); | |
43 element.itemProp.add("foo"); | |
44 shouldBeNull("element.itemProp.item(1)"); | |
45 shouldBeUndefined("element.itemProp[1]"); | |
46 element.itemProp.remove("foo"); | |
47 shouldBeNull("element.itemProp.item(0)"); | |
48 shouldBeUndefined("element.itemProp[0]"); | |
49 //Test with invalid index | |
50 shouldBeNull("element.itemProp.item(-1)"); | |
51 shouldBeUndefined("element.itemProp[-1]"); | |
52 </script> | |
53 <script src="../../js/resources/js-test-post.js"></script> | |
54 </body> | |
55 </html> | |
OLD | NEW |