purescript-deprecated/purescript-dom

currentTarget should be nullable

Closed this issue · 3 comments

coot commented

Myabe that specifc to React but the native event can have currentTarget null.

screenshot from 2017-06-27 21-49-39

garyb commented

Hmm, that is annoying. It's null if an event is created but hasn't come through the DOM - it can't be null if it's received otherwise, as it refers to the thing that addEventListener was attached to! But yeah, because it's possible, it should be typed as such.

coot commented

True, if I just do

m = new MouseEvent('click')

Then target, currentTarget, relatedTarget, view are all set to null, since there isn't any value they could yet have. But the event I originally posted has fired. It only missing the currentTarget maybe because it's after bubbling phase.

garyb commented

Will be resolved in the release for 0.12.