| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 | 4 |
| 5 <div id="testElement"></div> | 5 <div id="testElement"></div> |
| 6 | 6 |
| 7 <script> | 7 <script> |
| 8 | 8 |
| 9 test(function() { | 9 test(function() { |
| 10 testElement.style = "width: 60px; border-left-width: 30px;"; | 10 testElement.style = "width: 60px; border-left-width: 30px;"; |
| 11 | 11 |
| 12 var iterator = testElement.styleMap.entries(); | 12 var iterator = testElement.styleMap.entries(); |
| 13 var entry = iterator.next(); | 13 var entry = iterator.next(); |
| 14 assert_equals(entry.value[0], 'width'); | 14 assert_equals(entry.value[0], 'width'); |
| 15 assert_equals(entry.value[1].constructor.name, CSSSimpleLength.name); | 15 assert_equals(entry.value[1].constructor.name, CSSUnitValue.name); |
| 16 assert_equals(entry.value[1].cssText, '60px'); | 16 assert_equals(entry.value[1].cssText, '60px'); |
| 17 | 17 |
| 18 // This shouldn't appear in the iterator. | 18 // This shouldn't appear in the iterator. |
| 19 testElement.style.borderTopWidth = '10px'; | 19 testElement.style.borderTopWidth = '10px'; |
| 20 | 20 |
| 21 entry = iterator.next(); | 21 entry = iterator.next(); |
| 22 assert_equals(entry.value[0], 'border-left-width'); | 22 assert_equals(entry.value[0], 'border-left-width'); |
| 23 assert_equals(entry.value[1].constructor.name, CSSSimpleLength.name); | 23 assert_equals(entry.value[1].constructor.name, CSSUnitValue.name); |
| 24 assert_equals(entry.value[1].cssText, '30px'); | 24 assert_equals(entry.value[1].cssText, '30px'); |
| 25 | 25 |
| 26 assert_true(iterator.next().done); | 26 assert_true(iterator.next().done); |
| 27 }, "Adding a property while iterating over entries() doesn't affect iterator"); | 27 }, "Adding a property while iterating over entries() doesn't affect iterator"); |
| 28 | 28 |
| 29 test(function() { | 29 test(function() { |
| 30 testElement.style = "width: 60px; border-left-width: 30px;"; | 30 testElement.style = "width: 60px; border-left-width: 30px;"; |
| 31 | 31 |
| 32 var iterator = testElement.styleMap.values(); | 32 var iterator = testElement.styleMap.values(); |
| 33 var entry = iterator.next(); | 33 var entry = iterator.next(); |
| 34 assert_equals(entry.value.constructor.name, CSSSimpleLength.name); | 34 assert_equals(entry.value.constructor.name, CSSUnitValue.name); |
| 35 assert_equals(entry.value.cssText, '60px'); | 35 assert_equals(entry.value.cssText, '60px'); |
| 36 | 36 |
| 37 // This shouldn't appear in the iterator. | 37 // This shouldn't appear in the iterator. |
| 38 testElement.style.borderTopWidth = '10px'; | 38 testElement.style.borderTopWidth = '10px'; |
| 39 | 39 |
| 40 entry = iterator.next(); | 40 entry = iterator.next(); |
| 41 assert_equals(entry.value.constructor.name, CSSSimpleLength.name); | 41 assert_equals(entry.value.constructor.name, CSSUnitValue.name); |
| 42 assert_equals(entry.value.cssText, '30px'); | 42 assert_equals(entry.value.cssText, '30px'); |
| 43 | 43 |
| 44 assert_true(iterator.next().done); | 44 assert_true(iterator.next().done); |
| 45 }, "Adding a property while iterating over values() doesn't affect current itera
tor"); | 45 }, "Adding a property while iterating over values() doesn't affect current itera
tor"); |
| 46 | 46 |
| 47 test(function() { | 47 test(function() { |
| 48 testElement.style = "width: 60px; border-left-width: 30px;"; | 48 testElement.style = "width: 60px; border-left-width: 30px;"; |
| 49 | 49 |
| 50 var iterator = testElement.styleMap.keys(); | 50 var iterator = testElement.styleMap.keys(); |
| 51 var entry = iterator.next(); | 51 var entry = iterator.next(); |
| 52 assert_equals(entry.value, 'width'); | 52 assert_equals(entry.value, 'width'); |
| 53 | 53 |
| 54 // This shouldn't appear in the iterator. | 54 // This shouldn't appear in the iterator. |
| 55 testElement.style.borderTopWidth = '10px'; | 55 testElement.style.borderTopWidth = '10px'; |
| 56 | 56 |
| 57 entry = iterator.next(); | 57 entry = iterator.next(); |
| 58 assert_equals(entry.value, 'border-left-width'); | 58 assert_equals(entry.value, 'border-left-width'); |
| 59 | 59 |
| 60 assert_true(iterator.next().done); | 60 assert_true(iterator.next().done); |
| 61 }, "Adding a property while iterating over keys() doesn't affect iterator"); | 61 }, "Adding a property while iterating over keys() doesn't affect iterator"); |
| 62 | 62 |
| 63 </script> | 63 </script> |
| OLD | NEW |