WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 203288
156730
MediaQueryList.addListener does not support Object with handleEvent() method
https://bugs.webkit.org/show_bug.cgi?id=156730
Summary
MediaQueryList.addListener does not support Object with handleEvent() method
nkronlage
Reported
2016-04-18 22:18:56 PDT
Repro: var query = matchMedia("(min-width: 400px)"); var listener = { handleEvent: function() { document.body.style.background = query.matches ? 'red' : 'blue'; } } query.addListener(listener); listener.handleEvent(); Runnable:
https://jsfiddle.net/j4278otv/
Running this results in the error: "[Error] TypeError: Argument 1 ('listener') to MediaQueryList.addListener must be a function" The spec (
https://drafts.csswg.org/cssom-view/#mediaquerylist
) says the parameter to addListener is an EventListener (
https://dom.spec.whatwg.org/#callbackdef-eventlistener
): callback interface EventListener { void handleEvent(Event event); }; but the implementation only allows functions. The Node.addEventListener method does support the Object with handleEvent() method: See
https://jsfiddle.net/6nL0epf3/
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Shvayka
Comment 1
2020-04-03 09:41:56 PDT
*** This bug has been marked as a duplicate of
bug 203288
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug