{"size": 1551, "ext": "js", "max_stars_repo_path": "test/testcases/append-set-check.js", "max_stars_repo_name": "ewilligers/smil-web-animations", "max_stars_repo_stars_event_min_datetime": "2015-07-30T21:28:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-20T01:36:23.000Z", "max_issues_repo_path": "test/testcases/append-set-check.js", "max_issues_repo_name": "ewilligers/smil-web-animations", "max_issues_repo_issues_event_min_datetime": "2015-06-06T12:00:25.000Z", "max_issues_repo_issues_event_max_datetime": "2017-02-04T00:42:51.000Z", "max_forks_repo_path": "test/testcases/append-set-check.js", "max_forks_repo_name": "ewilligers/smil-web-animations", "max_forks_repo_forks_event_min_datetime": "2015-05-18T17:15:04.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-19T02:21:28.000Z"}
{"max_stars_count": 125, "max_issues_count": 12, "max_forks_count": 25, "avg_line_length": 31.02, "max_line_length": 61, "alphanum_fraction": 0.7137330754}
'use strict';

function createSet(rect, setTag, attributeName, to) {
  var attributes = {
    attributeType: 'XML',
    attributeName: attributeName,
    to: to
  };

  var setElement = document.createElementNS(
      'http://www.w3.org/2000/svg', setTag);
  for (var name in attributes) {
    setElement.setAttribute(name, attributes[name]);
  }
  rect.appendChild(setElement);

  // By accessing targetElement on the newly created element,
  // we force DOM mutations to be observed, otherwise they
  // would not be noticed until an event was received by the
  // mutation observer.
  setElement.targetElement.setAttribute('stroke-width', '4');
}

function addSetHeight() {
  var polyfillRect = document.getElementById('polyfillRect');
  var nativeRect = document.getElementById('nativeRect');

  createSet(polyfillRect, 'set', 'height', '200');
  createSet(nativeRect, 'nativeSet', 'height', '200');
}

function addSetWidth() {
  var polyfillRect = document.getElementById('polyfillRect');
  var nativeRect = document.getElementById('nativeRect');

  createSet(polyfillRect, 'set', 'width', '300');
  createSet(nativeRect, 'nativeSet', 'width', '300');
}

timing_test(function() {
  var polyfillRect = document.getElementById('polyfillRect');
  var nativeRect = document.getElementById('nativeRect');

  executeAt(1000, addSetHeight);
  at(1000, 'height', 200, polyfillRect, nativeRect);
  at(1000, 'stroke-width', 4, polyfillRect, nativeRect);
  executeAt(2000, addSetWidth);
  at(2000, 'width', 300, polyfillRect, nativeRect);
}, 'append set');
