How to implement code such as forcibly deleting dom event listener delete event listener in chrome debugging

Don"t tell me that removeEventListener or onXXX=null, is the first one to get the function name, and the second one is not valid for addEventListener add events.

May.27,2021

you can use getEventListeners to get event binding information on an element, and then unbind it through removeEventListener

poor compatibility, use with caution


I don't think there's anything I can do about it. The off implementation of jQuery simply leaves event references for standby.

but you can be smart. The node is changed into a string and then inserted back in. There will be no incident. It's exciting, not exciting. However, there is no way to entrust the event.

well, no, event delegates can stop bubbling on your newly inserted node


chrome can get a reference to the event, so removeEventListener is correct.

Menu