chromium/third_party/blink/web_tests/fast/events/touch/touch-input-element-change-documents.html

<script src="../../../resources/js-test.js"></script>
<div id='container'></div>
<script>
description("This test checks that we correctly update the touch event handler count when an Input element with default touch handlers changes documents.");


 shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '0');

 // There are two touchable Input element in Audio's shadow DOM when controls are enabled.
 var input = document.createElement('audio');
 input.setAttribute("controls", true);
 var container = document.getElementById('container');

 shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '0');

 container.appendChild(input);
 shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '2');
 shouldBe('internals.touchEndOrCancelEventHandlerCount(document)', '0');

 input.ontouchend = function() { };
 shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '2');
 shouldBe('internals.touchEndOrCancelEventHandlerCount(document)', '1');

 input.ontouchend = null;
 shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '2');
 shouldBe('internals.touchEndOrCancelEventHandlerCount(document)', '0');

 document.implementation.createDocument("", "", null).adoptNode(input);
 shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '0');


</script>
</body>