From a1c80737ba6c8d922ad96ce2e9bbffed5692c1e0 Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Tue, 12 Apr 2022 13:49:38 +0200 Subject: [PATCH 1/3] DOM: Test document.createEvent('touchevent') See https://github.com/whatwg/dom/pull/1071 --- .../Document-createEvent-touchevent.window.js | 11 +++++++++++ dom/nodes/Document-createEvent.https.html | 17 +++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 dom/nodes/Document-createEvent-touchevent.window.js diff --git a/dom/nodes/Document-createEvent-touchevent.window.js b/dom/nodes/Document-createEvent-touchevent.window.js new file mode 100644 index 00000000000000..a60866fb617736 --- /dev/null +++ b/dom/nodes/Document-createEvent-touchevent.window.js @@ -0,0 +1,11 @@ +for (const variant of ['TouchEvent', 'touchevent', 'TOUCHEVENT']) { + test(() => { + if (!('ontouchstart' in document)) { + assert_throws_dom("NOT_SUPPORTED_ERR", () => { + document.createEvent(variant); + }); + } else { + document.createEvent(variant); + } + }, `document.createEvent('${variant}') should throw if 'expose legacy touch event APIs' is false`); +} diff --git a/dom/nodes/Document-createEvent.https.html b/dom/nodes/Document-createEvent.https.html index 8e948a37e68630..48fddd35b1df6a 100644 --- a/dom/nodes/Document-createEvent.https.html +++ b/dom/nodes/Document-createEvent.https.html @@ -7,13 +7,20 @@