Skip to content

[cssom-view] The addListener(listener) spec doesn't match with current DOM spec #4407

@zcorpan

Description

@zcorpan

https://drafts.csswg.org/cssom-view/#example-5ecb609e

The addListener(listener) method must run these steps:​

If listener is null, terminate these steps.

Append an event listener to the associated list of event listeners with type set to change, callback set to listener, and capture set to false, unless there already is an event listener in that list with the same type, callback, and capture.

The removeListener(listener) method must run these steps:​

Remove an event listener from the associated list of event listeners, whose type is change, callback is listener, and capture is false.

This doesn't hook into DOM correctly anymore, I believe. It probably did when it was written but the DOM spec has since changed.

See https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener

cssom-view should say something like

The addListener(callback) method, when invoked, must run these steps:

  1. [Add an event listener] with the [context object] and an [event listener] whose type is change, callback is callback, capture is false, passive is false, and once is false.

The removeListener(callback) method, when invoked, must run these steps:

  1. If the [context object]’s [event listener list] [contains] an [event listener] whose type is change, callback is callback, and capture is false, then [remove an event listener] with the [context object] and that [event listener].

Related tests: web-platform-tests/wpt#18390 cc @shvaikalesh @annevk

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions