Documentation of html dom Event object?

后端 未结 2 637
南方客
南方客 2020-12-22 07:31

Can anyone point me to the documentation of the html Event object?


Bonus Reading

The only reason i know a global Event obje

相关标签:
2条回答
  • 2020-12-22 07:39

    Javascript itself is only a concept. Its a blend of different dialects like Jscript & Gecko Javascript. Now different browsers treat Javascript differently, so there are plethora of different documentation floating around in the internet.

    Now talking about the events:

    • IE has two events models
    • Mozilla and Safari two different ones
    • Opera has three

    And then compatibility:

    • the IE DOM0 events model works differently than the DOM0 events model of every other browser
    • the IE proprietary attachEvent events model (also supported by Opera) is different from the W3C DOM2 events model
    • Mozilla, Safari and Opera support W3C DOM2 events
    • the Event object has a very different set of properties in IE as compared to the other three, independent of which event model you're talking about.

    In fact, independent of which events model you're talking about, you will find differences between all four major browsers in various aspects. Thats why you are not finding a specific global documentation of event object.

    0 讨论(0)
  • 2020-12-22 07:40

    The MDN site provides very reliable information: https://developer.mozilla.org/en/DOM/event. Your event.toElement property is a non-standard Microsoft thing, a quick test showed undefined for the property in Firefox:

    <body onclick="alert(event.srcElement)">Click
    

    The correct property to use is target. Also note that event is not global, it is only a local variable. You are suggested to use addEventListener for adding DOM events as described in the MDN page.

    quirksmode.org has nice tables on compatibility across browsers.

    W3schools... well http://w3fools.com

    Since you want to know more about the IE-specific srcElement property, consult Microsofts documention. From srcElement property:

    Gets the element that the event was originally dispatched to. Compare to target.

    Remarks

    Note The srcElement property is provided for backward compatibility. Use the target property instead.

    0 讨论(0)
提交回复
热议问题