Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch cancel event to refine bubbling information #1220

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions tools/amend-event-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ const patches = {
pattern: { type: /^(cut|clipboardchange|paste|copy)$/ },
matched: 4,
change: {
interface: "ClipboardEvent",
interface: "ClipboardEvent",
targets: ["GlobalEventHandlers"],
bubbles: true
bubbles: true
}
}
],
Expand Down Expand Up @@ -183,15 +183,36 @@ const patches = {
matched: 7,
change: { interface: 'DragEvent', bubbles: true }
},
// The "HTMLElement" base interface receives most HTML events in theory,
// but some of the events only fire on specific HTML elements in practice.
// The following updates refine the target interfaces of these events.
// (This is not a temporary fix: "HTMLElement" is the correct target
// interface from a spec perspective, that's where the event handlers are
// defined)
// Also, the "cancel" event bubbles on input elements but not on other
// target interfaces, so we need to duplicate the entry in the extract.
{
pattern: { type: "cancel"},
matched: 1,
change: { targets: ["HTMLDialogElement", "HTMLInputElement"] }
change: { targets: ["HTMLInputElement"] }
},
{
add: {
type: "cancel",
interface: "Event",
bubbles: false,
targets: ["CloseWatcher", "HTMLDialogElement"],
href: "https://html.spec.whatwg.org/multipage/indices.html#event-cancel",
src: {
format: "summary table",
href: "https://html.spec.whatwg.org/multipage/indices.html#event-cancel"
}
}
},
{
pattern: { type: "close"},
matched: 1,
change: { targets: ["HTMLDialogElement" ] }
change: { targets: ["CloseWatcher", "HTMLDialogElement", "MessagePort"] }
},
{
pattern: { type: "change", targets: "HTMLElement"},
Expand Down