Skip to content

Commit

Permalink
Update GlobalEventHandlers list
Browse files Browse the repository at this point in the history
The IDL and impl files were not in sync, the list was not in sync with the spec, and the touch event handlers were missing.
  • Loading branch information
domenic committed May 27, 2023
1 parent a8b03af commit 5857f25
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 32 deletions.
106 changes: 78 additions & 28 deletions lib/jsdom/living/nodes/GlobalEventHandlers-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,87 @@

const { appendHandler, createEventAccessor } = require("../helpers/create-event-accessor");

// Must be kept in sync with GlobalEventHandlers.webidl.
const events = new Set([
"abort", "autocomplete",
"autocompleteerror", "blur",
"cancel", "canplay", "canplaythrough",
"change", "click",
"close", "contextmenu",
"cuechange", "dblclick",
"drag", "dragend",
"abort",
"auxclick",
"beforeinput",
"beforematch",
"beforetoggle",
"blur",
"cancel",
"canplay",
"canplaythrough",
"change",
"click",
"close",
"contextlost",
"contextmenu",
"contextrestored",
"copy",
"cuechange",
"cut",
"dblclick",
"drag",
"dragend",
"dragenter",
"dragleave", "dragover",
"dragstart", "drop",
"durationchange", "emptied",
"ended", "error", "focus",
"input", "invalid",
"keydown", "keypress",
"keyup", "load", "loadeddata",
"loadedmetadata", "loadstart",
"mousedown", "mouseenter",
"mouseleave", "mousemove",
"mouseout", "mouseover",
"mouseup", "wheel",
"pause", "play",
"playing", "progress",
"ratechange", "reset",
"resize", "scroll",
"dragleave",
"dragover",
"dragstart",
"drop",
"durationchange",
"emptied",
"ended",
"error",
"focus",
"formdata",
"input",
"invalid",
"keydown",
"keypress",
"keyup",
"load",
"loadeddata",
"loadedmetadata",
"loadstart",
"mousedown",
"mouseenter",
"mouseleave",
"mousemove",
"mouseout",
"mouseover",
"mouseup",
"paste",
"pause",
"play",
"playing",
"progress",
"ratechange",
"reset",
"resize",
"scroll",
"scrollend",
"securitypolicyviolation",
"seeked", "seeking",
"select", "sort", "stalled",
"submit", "suspend",
"timeupdate", "toggle",
"volumechange", "waiting"
"seeked",
"seeking",
"select",
"slotchange",
"stalled",
"submit",
"suspend",
"timeupdate",
"toggle",
"volumechange",
"waiting",
"webkitanimationend",
"webkitanimationiteration",
"webkitanimationstart",
"webkittransitionend",
"wheel",
"touchstart",
"touchend",
"touchmove",
"touchcancel"
]);

class GlobalEventHandlersImpl {
Expand Down
29 changes: 26 additions & 3 deletions lib/jsdom/living/nodes/GlobalEventHandlers.webidl
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
// https://html.spec.whatwg.org/#globaleventhandlers
// Must be kept in sync with GlobalEventHandlers-impl.js.

interface mixin GlobalEventHandlers {
attribute EventHandler onabort;
attribute EventHandler onauxclick;
attribute EventHandler onbeforeinput;
attribute EventHandler onbeforematch;
attribute EventHandler onbeforetoggle;
attribute EventHandler onblur;
attribute EventHandler oncancel;
attribute EventHandler oncanplay;
attribute EventHandler oncanplaythrough;
attribute EventHandler onchange;
attribute EventHandler onclick;
attribute EventHandler onclose;
attribute EventHandler oncontextlost;
attribute EventHandler oncontextmenu;
attribute EventHandler oncontextrestored;
attribute EventHandler oncopy;
attribute EventHandler oncuechange;
attribute EventHandler oncut;
attribute EventHandler ondblclick;
attribute EventHandler ondrag;
attribute EventHandler ondragend;
Expand All @@ -24,6 +32,7 @@ interface mixin GlobalEventHandlers {
attribute EventHandler onended;
attribute OnErrorEventHandler onerror;
attribute EventHandler onfocus;
attribute EventHandler onformdata;
attribute EventHandler oninput;
attribute EventHandler oninvalid;
attribute EventHandler onkeydown;
Expand All @@ -32,7 +41,6 @@ interface mixin GlobalEventHandlers {
attribute EventHandler onload;
attribute EventHandler onloadeddata;
attribute EventHandler onloadedmetadata;
attribute EventHandler onloadend;
attribute EventHandler onloadstart;
attribute EventHandler onmousedown;
[LegacyLenientThis] attribute EventHandler onmouseenter;
Expand All @@ -41,7 +49,7 @@ interface mixin GlobalEventHandlers {
attribute EventHandler onmouseout;
attribute EventHandler onmouseover;
attribute EventHandler onmouseup;
attribute EventHandler onwheel;
attribute EventHandler onpaste;
attribute EventHandler onpause;
attribute EventHandler onplay;
attribute EventHandler onplaying;
Expand All @@ -50,15 +58,30 @@ interface mixin GlobalEventHandlers {
attribute EventHandler onreset;
attribute EventHandler onresize;
attribute EventHandler onscroll;
attribute EventHandler onscrollend;
attribute EventHandler onsecuritypolicyviolation;
attribute EventHandler onseeked;
attribute EventHandler onseeking;
attribute EventHandler onselect;
attribute EventHandler onslotchange;
attribute EventHandler onstalled;
attribute EventHandler onsubmit;
attribute EventHandler onsuspend;
attribute EventHandler ontimeupdate;
attribute EventHandler ontoggle;
attribute EventHandler onvolumechange;
attribute EventHandler onwaiting;
attribute EventHandler onwebkitanimationend;
attribute EventHandler onwebkitanimationiteration;
attribute EventHandler onwebkitanimationstart;
attribute EventHandler onwebkittransitionend;
attribute EventHandler onwheel;
};

// https://w3c.github.io/touch-events/#extensions-to-the-globaleventhandlers-mixin
partial interface mixin GlobalEventHandlers {
attribute EventHandler ontouchstart;
attribute EventHandler ontouchend;
attribute EventHandler ontouchmove;
attribute EventHandler ontouchcancel;
};
1 change: 0 additions & 1 deletion test/web-platform-tests/to-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ DIR: dom/nodes
Document-URL.html: [fail, Unknown]
Document-characterSet-normalization-1.html: [timeout, Some encodings are not supported - see the whatwg-encoding module]
Document-characterSet-normalization-2.html: [timeout, Some encodings are not supported - see the whatwg-encoding module]
Document-createEvent-touchevent.window.html: [fail, Pointer events not implemented]
Document-createEvent.https.html: [fail, We don't support every event interface yet]
Document-getElementById.html: [fail, We cache IDs in insertion order]
Element-closest.html: [fail, :has is not supported (by all major browsers as well)]
Expand Down

0 comments on commit 5857f25

Please sign in to comment.