Skip to content

Event Handlers vs. Event Listener and implicit call to open() #225

Closed
@padenot

Description

@padenot

The spec currently states the following (emphasis mine):

Note that this call is NOT required in order to use the MIDIPort- calling send() on a MIDIOutput or attaching a MIDIMessageEvent handler on a MIDIInput will cause an implicit open().

This means that, if output is a MIDIOutput object, the following snippet (setting an event handler) opens the port:

output.onmidimessage = (m) => { console.log(m); }

but the following (adding an event listener) doesn't:

output.addEventListener("midimessage", () => { console.log(m); });

It seems like we need to state that both ways open the port, for Web Compat reasons.

https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers
https://dom.spec.whatwg.org/#concept-event-listener

Metadata

Metadata

Labels

Needs Editshttps://speced.github.io/spec-maintenance/about/Priority: Soonhttps://speced.github.io/spec-maintenance/about/category: enhancementhttps://www.w3.org/policies/process/#class-3

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions