-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: events handling #121
base: master
Are you sure you want to change the base?
fix: events handling #121
Conversation
Combined Distribution Script |
这次改动是要解决丢失 removeListener 的问题? |
之前只做了addEventListener,addEventListener跟removeEventListener是一對的 雖然很少機會會用removeEventListener,但你猜不到原本網站其他的XHR處理是怎樣,不理的話有機會報錯 |
getEventTarget(xhr)
document.createElement('a')
was used.document.createDocumentFragment()
would be a better way to create EventTarget since the creation of HTMLElement is slightly higher thanDocumentFragment
document.createDocumentFragment()
is well supported in ES5. (just Opera 10-12 is unknown)addEventListener and removeEventListener
removeEventListener
was missing, but mentioned inindex.d.ts
WeakMap
is used for this particular usage.WeakMap
in very old browsers might be not supported, in that case,removeEventListener
is ignored.Minor fix in event handler
changedthe type must be the same as theevent.type = args[0];
toevent.type = e.type;
to avoid memory leakage of arrayargs
.args[0]
. assignment not required.