OLD | NEW |
| (Empty) |
1 This tests element.dataset. | |
2 | |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | |
4 | |
5 | |
6 PASS testGet('data-foo', 'foo') is true | |
7 PASS testGet('data-foo-bar', 'fooBar') is true | |
8 PASS testGet('data--', '-') is true | |
9 PASS testGet('data--foo', 'Foo') is true | |
10 PASS testGet('data---foo', '-Foo') is true | |
11 PASS testGet('data---foo--bar', '-Foo-Bar') is true | |
12 PASS testGet('data---foo---bar', '-Foo--Bar') is true | |
13 PASS testGet('data-foo-', 'foo-') is true | |
14 PASS testGet('data-foo--', 'foo--') is true | |
15 PASS testGet('data-Foo', 'foo') is true | |
16 PASS testGet('data-', '') is true | |
17 PASS testGet('data-à', 'à') is true | |
18 PASS testGet('data-1', '1') is true | |
19 PASS testGet('data-01', '01') is true | |
20 PASS testGet('data-zx81', 'zx81') is true | |
21 PASS testGet('data-i4770k', 'i4770k') is true | |
22 PASS testGet('data-r-7', 'r-7') is true | |
23 PASS testGet('data-r-7-k', 'r-7K') is true | |
24 PASS document.body.dataset.nonExisting is undefined. | |
25 | |
26 PASS testIsUndefined('data-022', '22') is true | |
27 PASS testIsUndefined('data-22', '022') is true | |
28 | |
29 PASS matchesNothingInDataset('dataFoo') is true | |
30 | |
31 PASS testSet('foo', 'data-foo') is true | |
32 PASS testSet('fooBar', 'data-foo-bar') is true | |
33 PASS testSet('-', 'data--') is true | |
34 PASS testSet('Foo', 'data--foo') is true | |
35 PASS testSet('-Foo', 'data---foo') is true | |
36 PASS testSet('', 'data-') is true | |
37 PASS testSet('à', 'data-à') is true | |
38 PASS testSet('32', 'data-32') is true | |
39 PASS testSet('0032', 'data-0032') is true | |
40 PASS testSet('i18n', 'data-i18n') is true | |
41 PASS testSet('d2', 'data-d2') is true | |
42 PASS testSet('2d', 'data-2d') is true | |
43 PASS testSet('d-2', 'data-d-2') is true | |
44 PASS testSet('A--S', 'data--a---s') is true | |
45 | |
46 PASS testIsNull('0123', 'data-123') is true | |
47 PASS testIsNull('123', 'data-0123') is true | |
48 | |
49 PASS testSet('-foo', 'dummy') threw exception SyntaxError: Failed to set the '-f
oo' property on 'DOMStringMap': '-foo' is not a valid property name.. | |
50 PASS testSet('foo ', 'dummy') threw exception InvalidCharacterError: Failed to s
et the 'foo ' property on 'DOMStringMap': 'data-foo ' is not a valid attribute n
ame.. | |
51 FAIL testSet('foo豈', 'dummy') should throw InvalidCharacterError: Failed to set
the 'foo豈' property on 'DOMStringMap': 'data-foo豈' is not a valid attribute name
.. Threw exception InvalidCharacterError: Failed to set the 'fooï¤' property on
'DOMStringMap': 'data-foo豈' is not a valid attribute name.. | |
52 | |
53 PASS testDelete('data-foo', 'foo') is true | |
54 PASS testDelete('data-foo-bar', 'fooBar') is true | |
55 PASS testDelete('data--', '-') is true | |
56 PASS testDelete('data--foo', 'Foo') is true | |
57 PASS testDelete('data---foo', '-Foo') is true | |
58 PASS testDelete('data-', '') is true | |
59 PASS testDelete('data-à', 'à') is true | |
60 PASS testDelete('data-33', '33') is true | |
61 PASS testDelete('data-00033', '00033') is true | |
62 PASS testDelete('data-r2', 'r2') is true | |
63 PASS testDelete('data-2r', '2r') is true | |
64 PASS testDelete('data-r-2', 'r-2') is true | |
65 PASS testDelete('data--r-2-', 'R-2-') is true | |
66 PASS testDelete('data--r-2r', 'R-2r') is true | |
67 PASS testDelete('data--r-2-----r', 'R-2----R') is true | |
68 PASS testNativeDelete('foo', true) is true | |
69 | |
70 PASS testDelete('dummy', '-foo') is false | |
71 | |
72 PASS testForIn(['data-foo', 'data-bar', 'data-baz']) is 3 | |
73 PASS testForIn(['data-foo', 'data-bar', 'dataFoo']) is 2 | |
74 PASS testForIn(['data-foo', 'data-bar', 'style']) is 2 | |
75 PASS testForIn(['data-foo', 'data-bar', 'data-']) is 3 | |
76 PASS testForIn(['data-foo', 'data-bar', 'data-43']) is 3 | |
77 PASS testForIn(['data-foo', 'data-oric1', 'data-bar']) is 3 | |
78 PASS testForIn(['data-foo', 'data-oric-1', 'data-bar']) is 3 | |
79 PASS testForIn(['data-foo', 'data-oric-1x', 'data-bar']) is 3 | |
80 | |
81 Property override: | |
82 PASS Object.prototype.foo = 'on Object'; div.dataset.foo is 'on Object' | |
83 PASS div.dataset['foo'] = 'on dataset'; div.dataset.foo is 'on dataset' | |
84 PASS div.hasAttribute('data-foo') is true | |
85 PASS div.setAttribute('data-foo', 'attr'); div.dataset.foo is 'attr' | |
86 Update the JavaScript property: | |
87 PASS div.dataset.foo = 'updated'; div.dataset.foo is 'updated' | |
88 PASS div.getAttribute('data-foo') is 'updated' | |
89 PASS div.dataset.Bar = 'on dataset'; div.dataset.Bar is 'on dataset' | |
90 PASS div.hasAttribute('data-Bar') is false | |
91 Make the JavaScript property empty: | |
92 PASS div.dataset.foo = ''; div.dataset.foo is '' | |
93 PASS div.getAttribute('data-foo') is '' | |
94 Remove the attribute: | |
95 PASS div.removeAttribute('data-foo'); div.dataset.foo is 'on Object' | |
96 Remove the JavaScript property: | |
97 PASS div.setAttribute('data-foo', 'attr'); delete div.dataset.foo; div.dataset.f
oo is 'on Object' | |
98 PASS div.hasAttribute('foo') is false | |
99 PASS delete div.dataset.Bar; div.dataset.Bar is undefined. | |
100 PASS Object.prototype[11] = 'on Object'; div.dataset[11] is 'on Object' | |
101 PASS div.dataset['11'] = 'on dataset'; div.dataset[11] is 'on dataset' | |
102 PASS div.hasAttribute('data-11') is true | |
103 PASS div.setAttribute('data-11', 'attr'); div.dataset[11] is 'attr' | |
104 Update the JavaScript property: | |
105 PASS div.dataset[11] = 'updated'; div.dataset[11] is 'updated' | |
106 PASS div.getAttribute('data-11') is 'updated' | |
107 PASS Object.prototype['a500'] = 'on Object'; div.dataset['a500'] is 'on Object' | |
108 PASS div.dataset['a500'] = 'on dataset'; div.dataset['a500'] is 'on dataset' | |
109 PASS div.hasAttribute('data-a500') is true | |
110 PASS div.setAttribute('data-a500', 'attr'); div.dataset['a500'] is 'attr' | |
111 Update the JavaScript property: | |
112 PASS div.dataset['a500'] = 'updated'; div.dataset['a500'] is 'updated' | |
113 PASS div.getAttribute('data-a500') is 'updated' | |
114 PASS Object.prototype['a-500k'] = 'on Object'; div.dataset['a-500k'] is 'on Obje
ct' | |
115 PASS div.dataset['a-500k'] = 'on dataset'; div.dataset['a-500k'] is 'on dataset' | |
116 PASS div.hasAttribute('data-a-500k') is true | |
117 PASS div.setAttribute('data-a-500k', 'attr'); div.dataset['a-500k'] is 'attr' | |
118 Update the JavaScript property: | |
119 PASS div.dataset['a-500k'] = 'updated'; div.dataset['a-500k'] is 'updated' | |
120 PASS div.getAttribute('data-a-500k') is 'updated' | |
121 | |
122 Set null: | |
123 PASS d.dataset.foo is 'null' | |
124 | |
125 PASS successfullyParsed is true | |
126 | |
127 TEST COMPLETE | |
128 | |
OLD | NEW |