chromium/third_party/blink/web_tests/typedcssom/inlinestyle/inlineStylePropertyMap_iterationWithModification.html

<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<div id="testElement"></div>

<script>

test(function() {
  testElement.style = "width: 60px; border-left-width: 30px;";

  var iterator = testElement.attributeStyleMap.entries();

  // This shouldn't appear in the iterator.
  testElement.style.borderTopWidth = '10px';

  var entry = iterator.next();
  assert_equals(entry.value[0], 'width');
  assert_equals(entry.value[1].length, 1);
  assert_equals(entry.value[1][0].constructor.name, CSSUnitValue.name);
  assert_equals(entry.value[1][0].toString(), '60px');

  entry = iterator.next();
  assert_equals(entry.value[0], 'border-left-width');
  assert_equals(entry.value[1].length, 1);
  assert_equals(entry.value[1][0].constructor.name, CSSUnitValue.name);
  assert_equals(entry.value[1][0].toString(), '30px');

  assert_true(iterator.next().done);
}, "Adding a property while iterating over entries() doesn't affect iterator");

test(function() {
  testElement.style = "width: 60px; border-left-width: 30px;";

  var iterator = testElement.attributeStyleMap.values();

  // This shouldn't appear in the iterator.
  testElement.style.borderTopWidth = '10px';

  var entry = iterator.next();
  assert_equals(entry.value.length, 1);
  assert_equals(entry.value[0].constructor.name, CSSUnitValue.name);
  assert_equals(entry.value[0].toString(), '60px');

  entry = iterator.next();
  assert_equals(entry.value.length, 1);
  assert_equals(entry.value[0].constructor.name, CSSUnitValue.name);
  assert_equals(entry.value[0].toString(), '30px');

  assert_true(iterator.next().done);
}, "Adding a property while iterating over values() doesn't affect current iterator");

test(function() {
  testElement.style = "width: 60px; border-left-width: 30px;";

  var iterator = testElement.attributeStyleMap.keys();

  // This shouldn't appear in the iterator.
  testElement.style.borderTopWidth = '10px';

  var entry = iterator.next();
  assert_equals(entry.value, 'width');

  entry = iterator.next();
  assert_equals(entry.value, 'border-left-width');

  assert_true(iterator.next().done);
}, "Adding a property while iterating over keys() doesn't affect iterator");

</script>