canjs / can-zone

A context for tracking asynchronous activity in JavaScript applications.
https://v4.canjs.com/doc/can-zone.html
MIT License
92 stars 4 forks source link

fix: allow third-party library to also wrap events in strict-mode #165

Closed cleong-tc closed 6 years ago

cleong-tc commented 6 years ago

we are using a third-party library (i.e. https://cdn1-sandbox.affirm.com/js/v2/affirm.js ) that wraps addEventListener that is throwing a TypeError-exception (in javascript script-mode) since can-zone@0.6.17.

the TypeError-exception that i am seeing (in chrome-browser) is...

TypeError: Cannot assign to read only property 'addEventListener' of object '#<HTMLDivElement>'

can-zone@0.6.17 switched from simple-assignment to Object.defineProperty() (in register.js) but did not enable the writable-flag, so the third-party library could not also wrap addEventListener in strict-mode.