target:
  • 第一次触发事件的原始元素
  • A reference to the target to which the event was originally dispatched.
  • IE浏览器兼容性:

currentTarget
  • 冒泡过程中,当前正在处理事件的元素
  • A reference to the currently registered target for the event. This is the object to which the event is currently slated to be sent to; it's possible this has been changed along the way through retargeting.
relatedTarget:
  • 对双向事件有效。比如focus。有一个target获得焦点,就一个target失去焦点。失去焦点的target就叫relatedTarget
    • 问题:在svg中,如果获得焦点的元素没有添加focusIn事件,那么focusOut事件的relatedTarget为null 。这个设计不好吧。

currentTarget &target&relatedTarget比较

2019-02-17 16:05:08 0 25
这里是评论

相关推荐