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 <script> | |
8 description("This test verifies itemtype, itemref, itemprop attributes behavior
on adding a token in presence of trailing space characters."); | |
9 | |
10 var element; | |
11 | |
12 function createDivWithAttribute(attrName, value) | |
13 { | |
14 element = document.createElement('div'); | |
15 element.setAttribute(attrName, value); | |
16 } | |
17 | |
18 function checkResult(actual, expected, description) | |
19 { | |
20 if (actual == expected) | |
21 testPassed(description); | |
22 else | |
23 testFailed(description + " expected '" + expected + "' but got " + actua
l); | |
24 } | |
25 | |
26 debug("Test itemRef attribute's behavior"); | |
27 createDivWithAttribute('itemref', 'a '); | |
28 element.itemRef.add('b'); | |
29 checkResult(element.itemRef.toString(), "a b", "itemRef.add should treat ' ' as
a space"); | |
30 | |
31 createDivWithAttribute('itemref', 'a\t'); | |
32 element.itemRef.add('b'); | |
33 checkResult(element.itemRef.toString(), "a\tb", "itemRef.add should treat '\\t'
as a space"); | |
34 | |
35 createDivWithAttribute('itemref', 'a\f'); | |
36 element.itemRef.add('b'); | |
37 checkResult(element.itemRef.toString(), "a\fb", "itemRef.add should treat '\\f'
as a space"); | |
38 | |
39 createDivWithAttribute('itemref', 'a\r'); | |
40 element.itemRef.add('b'); | |
41 checkResult(element.itemRef.toString(), "a\rb", "itemRef.add should treat '\\r'
as a space"); | |
42 | |
43 createDivWithAttribute('itemref', 'a\n'); | |
44 element.itemRef.add('b'); | |
45 checkResult(element.itemRef.toString(), "a\nb", "itemRef.add should treat '\\n'
as a space"); | |
46 | |
47 debug(""); | |
48 debug("Test itemType attribute's behavior"); | |
49 createDivWithAttribute('itemtype', 'a '); | |
50 element.itemType.add('b'); | |
51 checkResult(element.itemType.toString(), "a b", "itemType.add should treat ' ' a
s a space"); | |
52 | |
53 createDivWithAttribute('itemtype', 'a\t'); | |
54 element.itemType.add('b'); | |
55 checkResult(element.itemType.toString(), "a\tb", "itemType.add should treat '\\t
' as a space"); | |
56 | |
57 createDivWithAttribute('itemtype', 'a\f'); | |
58 element.itemType.add('b'); | |
59 checkResult(element.itemType.toString(), "a\fb", "itemType.add should treat '\\f
' as a space"); | |
60 | |
61 createDivWithAttribute('itemtype', 'a\r'); | |
62 element.itemType.add('b'); | |
63 checkResult(element.itemType.toString(), "a\rb", "itemType.add should treat '\\r
' as a space"); | |
64 | |
65 createDivWithAttribute('itemtype', 'a\n'); | |
66 element.itemType.add('b'); | |
67 checkResult(element.itemType.toString(), "a\nb", "itemType.add should treat '\\n
' as a space"); | |
68 | |
69 debug(""); | |
70 debug("Test itemProp attribute's behavior"); | |
71 createDivWithAttribute('itemprop', 'a '); | |
72 element.itemProp.add('b'); | |
73 checkResult(element.itemProp.toString(), "a b", "itemType.add should treat ' ' a
s a space"); | |
74 | |
75 createDivWithAttribute('itemprop', 'a\t'); | |
76 element.itemProp.add('b'); | |
77 checkResult(element.itemProp.toString(), "a\tb", "itemType.add should treat '\\t
' as a space"); | |
78 | |
79 createDivWithAttribute('itemprop', 'a\f'); | |
80 element.itemProp.add('b'); | |
81 checkResult(element.itemProp.toString(), "a\fb", "itemType.add should treat '\\f
' as a space"); | |
82 | |
83 createDivWithAttribute('itemprop', 'a\r'); | |
84 element.itemProp.add('b'); | |
85 checkResult(element.itemProp.toString(), "a\rb", "itemType.add should treat '\\r
' as a space"); | |
86 | |
87 createDivWithAttribute('itemprop', 'a\n'); | |
88 element.itemProp.add('b'); | |
89 checkResult(element.itemProp.toString(), "a\nb", "itemType.add should treat '\\n
' as a space"); | |
90 </script> | |
91 <script src="../../js/resources/js-test-post.js"></script> | |
92 </body> | |
93 </html> | |
OLD | NEW |