Skip to content

Conversation

@ryo-fujinone
Copy link

fix #112

In some events, mergeObjects() fails to copy certain properties

When merging progress and abort events, several errors occur (probably also with error events and timeout events).
* Since there is a try-catch, xhook does not stop and no error is output.

TypeError: Cannot set property currentTarget of #<Event> which has only a getter
TypeError: Cannot assign to read only property 'CAPTURING_PHASE' of object '#<Event>'

This can be fixed by using Object.defineProperty().

currentTarget is missing in all events

As mentioned above, mergeObjects() fails to copy currentTarget.
In addition, events dispatched by xhook with empty objects do not include currentTarget.
In other words, currentTarget is missing from every event.
This can be fixed by using Object.defineProperty() for events where currentTarget is null.

* I intentionally left out srcElement because it’s a deprecated alias for target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

event fired on readystatechange doesn't contain currentTarget

1 participant