From 26e89ae6d3c63c1ef40414cd2f8e355524c1560a Mon Sep 17 00:00:00 2001 From: rhysd Date: Wed, 15 Jan 2020 11:29:30 +0900 Subject: [PATCH 1/2] use complete list of DOM event handlers --- src/js.rs | 104 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 86 insertions(+), 18 deletions(-) diff --git a/src/js.rs b/src/js.rs index 18ae0de..b2fa07d 100644 --- a/src/js.rs +++ b/src/js.rs @@ -1,29 +1,97 @@ const JS_DOM_EVENT_ATTRS: &[&str] = &[ - // Input - "onfocus", + // From WhatWG HTML spec 8.1.5.2 Event handlers on elements, Document objects, and Window objects: + // https://html.spec.whatwg.org/#event-handlers-on-elements,-document-objects,-and-window-objects + // https://html.spec.whatwg.org/#attributes-3 (table 'List of event handler content attributes') + + // Global handlers + "onabort", + "onauxclick", "onblur", - "onselect", + "oncancel", + "oncanplay", + "oncanplaythrough", "onchange", - "onsubmit", - "onreset", + "onclick", + "onclose", + "oncontextmenu", + "oncuechange", + "ondblclick", + "ondrag", + "ondragend", + "ondragenter", + "ondragexit", + "ondragleave", + "ondragover", + "ondragstart", + "ondrop", + "ondurationchange", + "onemptied", + "onended", + "onerror", + "onfocus", + "onformdata", + "oninput", + "oninvalid", "onkeydown", "onkeypress", "onkeyup", - // Mouse - "onmouseover", - "onmouseout", - "onmousedown", - "onmouseup", - "onmousemove", - // Click - "onclick", - "ondblclick", - // Load "onload", - "onunload", - "onabort", - "onerror", + "onloadeddata", + "onloadedmetadata", + "onloadstart", + "onmousedown", + "onmouseenter", + "onmouseleave", + "onmousemove", + "onmouseout", + "onmouseover", + "onmouseup", + "onwheel", + "onpause", + "onplay", + "onplaying", + "onprogress", + "onratechange", + "onreset", "onresize", + "onscroll", + "onsecuritypolicyviolation", + "onseeked", + "onseeking", + "onselect", + "onslotchange", + "onstalled", + "onsubmit", + "onsuspend", + "ontimeupdate", + "ontoggle", + "onvolumechange", + "onwaiting", + "onwebkitanimationend", + "onwebkitanimationiteration", + "onwebkitanimationstart", + "onwebkittransitionend", + // body and frameset elements + "onafterprint", + "onbeforeprint", + "onbeforeunload", + "onhashchange", + "onlanguagechange", + "onmessage", + "onmessageerror", + "onoffline", + "ononline", + "onpagehide", + "onpageshow", + "onpopstate", + "onrejectionhandled", + "onstorage", + "onunhandledrejection", + "onunload", + // html element + "oncut", + "oncopy", + "onpaste", ]; // Returns true if DOM attribute name matches a native JavaScript event handler From 1779f4a374773e04d3cdf9e916216bda206d7926 Mon Sep 17 00:00:00 2001 From: rhysd Date: Wed, 15 Jan 2020 14:33:27 +0900 Subject: [PATCH 2/2] better comments for JS_DOM_EVENT_ATTRS constant --- src/js.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js.rs b/src/js.rs index b2fa07d..b8d9f2d 100644 --- a/src/js.rs +++ b/src/js.rs @@ -1,9 +1,9 @@ const JS_DOM_EVENT_ATTRS: &[&str] = &[ - // From WhatWG HTML spec 8.1.5.2 Event handlers on elements, Document objects, and Window objects: + // From WHATWG HTML spec 8.1.5.2 'Event handlers on elements, Document objects, and Window objects': // https://html.spec.whatwg.org/#event-handlers-on-elements,-document-objects,-and-window-objects // https://html.spec.whatwg.org/#attributes-3 (table 'List of event handler content attributes') - // Global handlers + // Global event handlers "onabort", "onauxclick", "onblur", @@ -71,7 +71,7 @@ const JS_DOM_EVENT_ATTRS: &[&str] = &[ "onwebkitanimationiteration", "onwebkitanimationstart", "onwebkittransitionend", - // body and frameset elements + // Event handlers for and elements "onafterprint", "onbeforeprint", "onbeforeunload", @@ -88,7 +88,7 @@ const JS_DOM_EVENT_ATTRS: &[&str] = &[ "onstorage", "onunhandledrejection", "onunload", - // html element + // Event handlers for element "oncut", "oncopy", "onpaste",