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