Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3ac0fc0

Browse filesBrowse files
authored
TouchEvent: expose legacy touch event APIs
See w3c/touch-events#111
1 parent 7a49b3a commit 3ac0fc0
Copy full SHA for 3ac0fc0

File tree

Expand file treeCollapse file tree

2 files changed

+20
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-0
lines changed
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE HTML>
2+
<meta charset=utf-8>
3+
<title>Expose legacy touch event APIs</title>
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<script>
7+
const exposeLegacyTouchEventAPIs = 'ontouchstart' in document;
8+
for (const eventHandler of ['ontouchstart', 'ontouchmove', 'ontouchend', 'ontouchcancel']) {
9+
for (const eventTarget of [window, HTMLElement.prototype, SVGElement.prototype, Document.prototype]) {
10+
test(() => {
11+
assert_equals(eventHandler in eventTarget, exposeLegacyTouchEventAPIs);
12+
}, `'${eventHandler}' in ${eventTarget}`);
13+
}
14+
}
15+
</script>

‎touch-events/touch-globaleventhandler-interface.html

Copy file name to clipboardExpand all lines: touch-events/touch-globaleventhandler-interface.html
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
<script src="/resources/testharness.js"></script>
44
<script src="/resources/testharnessreport.js"></script>
55
<script>
6+
function supportsTouchEvents() {
7+
assert_implements_optional('ontouchstart' in document, "'expose legacy touch event APIs'");
8+
}
69
test(function() {
10+
supportsTouchEvents();
711
var touch_event_list = ['ontouchstart', 'ontouchmove', 'ontouchend', 'ontouchcancel'];
812
var global_event_handlers = [window, HTMLElement.prototype, SVGElement.prototype, Document.prototype];
913
for (var i in touch_event_list) {
@@ -14,6 +18,7 @@
1418
}, "Touch events in GlobalEventHandlers");
1519

1620
test(function() {
21+
supportsTouchEvents();
1722
var touch_event_list = ['ontouchstart', 'ontouchmove', 'ontouchend', 'ontouchcancel'];
1823
var global_event_handlers = [window, HTMLElement.prototype, SVGElement.prototype, Document.prototype];
1924
for (var i in touch_event_list) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.