<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<link rel=author href="mailto:rniwa@webkit.org">
<link rel=help href="https://bugs.webkit.org/show_bug.cgi?id=27795">
<link rel=help href="https://github.com/whatwg/html/issues/2368">
<link rel=help href="https://github.com/whatwg/html/issues/5886">
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<span><input id="test" type="text" disabled></span>

<script>
async function rafPromise() {
  return new Promise(resolve => requestAnimationFrame(resolve));
}

function clickOn(element)
{
    var x = element.offsetLeft + element.offsetWidth / 2;
    var y = element.offsetTop + element.offsetHeight / 2;
    eventSender.mouseMoveTo(x, y);
    eventSender.mouseDown();
    eventSender.mouseUp();
}

promise_test(async () => {
  const test = document.getElementById('test');
  test.parentNode.addEventListener('mousedown', () => assert_unreached('mousedown should not be fired.'));

  clickOn(test);

  await rafPromise();
  await rafPromise();
}, 'mousedown events should not be fired on parents of disabled input elements.');
</script>
