- From: Lea Verou <notifications@github.com>
- Date: Wed, 09 Mar 2022 07:19:44 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 9 March 2022 15:19:56 UTC
Sorry if this has been mentioned already, but re:security and encapsulation concerns: but developers can already intercept `addEventListener` by doing something like
```js
let addEventListener = EventTarget.prototype.addEventListener;
let removeEventListener = EventTarget.prototype.removeEventListener;
EventTarget.prototype.addEventListener = function(type, callback, options) {
/* store args and then… */
addEventListener.call(this, type, callback, options);
};
EventTarget.prototype.removeEventListener = function(type, callback, options) {
/* remove from stored args and then… */
removeEventListener.call(this, type, callback, options);
};
```
The problem is just that a) it's flimsy, since listeners may have been attached before the code was run and b) it's suboptimal to be overwriting built-ins like that.
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/412#issuecomment-1063030595
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/dom/issues/412/1063030595@github.com>
Received on Wednesday, 9 March 2022 15:19:56 UTC