mirror of
https://github.com/servo/servo.git
synced 2025-08-30 01:28:21 +01:00
script: Add remaining unique element event listeners (#38888)
This adds the remaining window as well as specific svg and animation listeners. The test suite was erroring before, as we don't implement `SVGAnimationElement` yet. Now, the test gracefully checks if the interface exists before doing a lookup. Part of #36258 Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
parent
c4b2f3af56
commit
d38533530b
5 changed files with 41 additions and 13 deletions
|
@ -70,8 +70,10 @@ use crate::script_runtime::CanGc;
|
|||
|
||||
/// <https://html.spec.whatwg.org/multipage/#event-handler-content-attributes>
|
||||
/// containing the values from
|
||||
/// <https://html.spec.whatwg.org/multipage/#globaleventhandlers>
|
||||
static CONTENT_EVENT_HANDLER_NAMES: [&str; 85] = [
|
||||
/// <https://html.spec.whatwg.org/multipage/#globaleventhandlers> and
|
||||
/// <https://html.spec.whatwg.org/multipage/#windoweventhandlers> as well as
|
||||
/// specific attributes for elements
|
||||
static CONTENT_EVENT_HANDLER_NAMES: [&str; 108] = [
|
||||
"onabort",
|
||||
"onauxclick",
|
||||
"onbeforeinput",
|
||||
|
@ -160,6 +162,32 @@ static CONTENT_EVENT_HANDLER_NAMES: [&str; 85] = [
|
|||
// https://w3c.github.io/selection-api/#extensions-to-globaleventhandlers-interface
|
||||
"onselectstart",
|
||||
"onselectionchange",
|
||||
// https://html.spec.whatwg.org/multipage/#windoweventhandlers
|
||||
"onafterprint",
|
||||
"onbeforeprint",
|
||||
"onbeforeunload",
|
||||
"onhashchange",
|
||||
"onlanguagechange",
|
||||
"onmessage",
|
||||
"onmessageerror",
|
||||
"onoffline",
|
||||
"ononline",
|
||||
"onpagehide",
|
||||
"onpagereveal",
|
||||
"onpageshow",
|
||||
"onpageswap",
|
||||
"onpopstate",
|
||||
"onrejectionhandled",
|
||||
"onstorage",
|
||||
"onunhandledrejection",
|
||||
"onunload",
|
||||
// https://w3c.github.io/encrypted-media/#attributes-3
|
||||
"onencrypted",
|
||||
"onwaitingforkey",
|
||||
// https://svgwg.org/svg2-draft/interact.html#AnimationEvents
|
||||
"onbegin",
|
||||
"onend",
|
||||
"onrepeat",
|
||||
];
|
||||
|
||||
#[derive(Clone, JSTraceable, MallocSizeOf, PartialEq)]
|
||||
|
|
2
tests/wpt/meta/MANIFEST.json
vendored
2
tests/wpt/meta/MANIFEST.json
vendored
|
@ -524326,7 +524326,7 @@
|
|||
[]
|
||||
],
|
||||
"event-handler-attributes.mjs": [
|
||||
"8d54524950b9c09d8e4dccbb369968262c3098fd",
|
||||
"3ac700d3dbf73d85c95109e6662baf4db43835f4",
|
||||
[]
|
||||
],
|
||||
"frame-without-trusted-types.html": [
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
[TrustedTypePolicyFactory-getAttributeType-event-handler-content-attributes.tentative.html]
|
||||
expected: ERROR
|
|
@ -1,2 +0,0 @@
|
|||
[set-event-handlers-content-attributes.tentative.html]
|
||||
expected: ERROR
|
|
@ -35,13 +35,17 @@ export async function getEventHandlerAttributeWithInterfaceNames() {
|
|||
addOnAttributes(htmlIDL, interfaceName);
|
||||
});
|
||||
|
||||
const encryptedMediaIDL = await (await fetch("/interfaces/encrypted-media.idl")).text();
|
||||
// HTMLMediaElement (the parent for <audio> and <video>) has extra event handlers.
|
||||
addOnAttributes(encryptedMediaIDL, "HTMLMediaElement");
|
||||
if ("HTMLMediaElement" in self) {
|
||||
const encryptedMediaIDL = await (await fetch("/interfaces/encrypted-media.idl")).text();
|
||||
// HTMLMediaElement (the parent for <audio> and <video>) has extra event handlers.
|
||||
addOnAttributes(encryptedMediaIDL, "HTMLMediaElement");
|
||||
}
|
||||
|
||||
const svgAnimationsIDL = await (await fetch("/interfaces/svg-animations.idl")).text();
|
||||
// SVGAnimationElement has extra event handlers.
|
||||
addOnAttributes(svgAnimationsIDL, "SVGAnimationElement");
|
||||
if ("SVGAnimationElement" in self) {
|
||||
const svgAnimationsIDL = await (await fetch("/interfaces/svg-animations.idl")).text();
|
||||
// SVGAnimationElement has extra event handlers.
|
||||
addOnAttributes(svgAnimationsIDL, "SVGAnimationElement");
|
||||
}
|
||||
|
||||
return attributeNamesWithInterfaceName;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue