invalidCount, 1);

  assert_false(form.reportValidity());
  assert_equals(invalidCount, 2);

  container.querySelector('input[type=submit]').click();
  assert_equals(invalidCount, 3);
}, 'Custom control affects validation at the owner form');

function isValidAccordingToCSS(element, comment) {
  assert_true(element.matches(':valid'), comment ? (comment + ' - :valid') : undefined);
  assert_false(element.matches(':invalid'), comment ? (comment + ' - :invalid') : undefined);
}

function isInvalidAccordingToCS