출처: http://www.quirksmode.org/dom/events/index.html
Event compatibility tables
Last updated on 22 February 2009.
See section 7B of the book.
Mozilla documentation. Be sure to study the "Other events", too.
Safari has always referred to my compatibility tables for more JavaScript information, so you’re currently reading the Safari documentation.
Opera documentation; unfortunately the events are summed up on a per-tag basis.
W3C DOM Events specification. Unfortunately it does not always pay attention to the current implementation of the events in the browsers.
On this page I give a quick overview of events browser compatibility.
I assume that you know the three event registration models (traditional, W3C and Microsoft) as well as event bubbling and capturing.
I spent most of my time on the cross-browser events; the links in the first compatibility table lead to even more compatibility tables with detailed information about these events.
I merely tested basic browser support for the Microsoft and W3C events without delving too deeply into the details.
Cross-browser events
Definition: cross-browser events are supported by IE and at least two of the following three browsers: Firefox, Safari, Opera.
All bugs noted in the table below are explained on the detail pages. I haven’t tested the load and unload events yet; they’ll be added to the table later on.
See the iPhone Events blog entry for more information on events on the iPhone.
Event | IE 5.5 | IE 6 | IE 7 | IE8rc1 as IE7 | IE8rc1 as IE8 | FF 2.0 | FF 3.0 | FF 3.1b2 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Chrome 1.0 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
When an element loses the focus. |
Yes | Too many | Yes | Incom |
Almost | Incom |
Almost | Too many | Incom | ||||||
| |||||||||||||||
When a form field value changes. |
Buggy | Yes | Yes | Yes | Incom |
Incom | |||||||||
| |||||||||||||||
When a mousedown and mouseup event occur on the same element OR an element is activated by the keyboard. |
Yes | Yes | Yes | Yes | Yes | Yes | |||||||||
| |||||||||||||||
Event | IE 5.5 | IE 6 | IE 7 | IE8rc1 as IE7 | IE8rc1 as IE8 | FF 2.0 | FF 3.0 | FF 3.1b2 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Chrome 1.0 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 |
When the user right-clicks to get the context menu. |
Yes | Buggy | Yes | Buggy | Yes | Untest |
Yes | No | No | ||||||
Preventing the default (i.e. preventing the context menu from appearing) is the whole point of this event.
| |||||||||||||||
When text is copied. |
Yes | No | Buggy | Yes | Untest |
Yes | No | No | |||||||
| |||||||||||||||
When text is cut. |
Yes | No | Buggy | Yes | Untest |
Yes | No | No | |||||||
| |||||||||||||||
When two click events take place on the same element within a reasonable timeframe. |
Yes | Yes | Yes | No | Yes | Yes | No | ||||||||
When the browser encounters a JavaScript error or a non-existent image file. |
Almost | Almost | Incom |
Incom |
Incom |
Incom | |||||||||
| |||||||||||||||
Event | IE 5.5 | IE 6 | IE 7 | IE8rc1 as IE7 | IE8rc1 as IE8 | FF 2.0 | FF 3.0 | FF 3.1b2 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Chrome 1.0 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 |
When an element receives the focus. |
Yes | Too many | Incom |
Almost | Incom |
Almost | Too many | Incom | |||||||
| |||||||||||||||
When the user depresses a key. |
Yes | Yes | Yes | Yes | Minimal | Incom | |||||||||
The event should continue firing as long as the user keeps the key depressed.
| |||||||||||||||
When a keystroke leads to a character being added to an HTML element. |
Yes | Too many | Too many | Yes | No | Yes | Too many | Too many | |||||||
This event should fire only if a keystroke leads to a character actually being added to an HTML element such as a text input. It should not fire when the user presses keys like the arrow keys which do not result in a character. The event should continue firing as long as the user keeps the key depressed.
| |||||||||||||||
When the user releases a key. |
Yes | Yes | Yes | Yes | Yes | Yes | |||||||||
This event fires after the keystroke has been processed; for instance after a character has been added to a text input. It’s not possible to cancel the default action because that action has already taken place. This event should not repeat. | |||||||||||||||
Event | IE 5.5 | IE 6 | IE 7 | IE8rc1 as IE7 | IE8rc1 as IE8 | FF 2.0 | FF 3.0 | FF 3.1b2 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Chrome 1.0 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 |
When the user depresses a mouse button. |
Yes | Yes | Yes | Yes | Yes | Yes | |||||||||
| |||||||||||||||
When the mouse is moved. | Yes | Yes | Yes | Alter |
Yes | Yes | Yes | ||||||||
| |||||||||||||||
When the mouse leaves an element. |
Yes | Yes | Yes | Alter |
Yes | Yes | Yes | ||||||||
| |||||||||||||||
When the mouse enters an element. |
Yes | Yes | Yes | Alter |
Yes | Yes | Yes | ||||||||
| |||||||||||||||
When the user releases a mouse button. |
Yes | Yes | Yes | Yes | Yes | Yes | |||||||||
| |||||||||||||||
Event | IE 5.5 | IE 6 | IE 7 | IE8rc1 as IE7 | IE8rc1 as IE8 | FF 2.0 | FF 3.0 | FF 3.1b2 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Chrome 1.0 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 |
When the user uses the mousewheel. Note that the page does not have to scroll for the event to fire. |
No | Yes | Buggy | No | Yes | Alter |
Yes | Yes | No | ||||||
It is possible to cancel the default action so that the element does not scroll.
| |||||||||||||||
When text is pasted. |
Yes | No | Buggy | Yes | Untest |
Yes | No | No | |||||||
| |||||||||||||||
When the user resets a form. |
Yes | Yes | Yes | Yes | Yes | Yes | |||||||||
When the window is resized. |
Yes | Yes | Yes | Buggy | Yes | Yes | Yes | ||||||||
| |||||||||||||||
Event | IE 5.5 | IE 6 | IE 7 | IE8rc1 as IE7 | IE8rc1 as IE8 | FF 2.0 | FF 3.0 | FF 3.1b2 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Chrome 1.0 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 |
When something is scrolled. |
Yes | Yes | Buggy | Yes | Buggy | Yes | No | ||||||||
| |||||||||||||||
When the user selects text in a text input field. |
Yes | Yes | Yes | Untest |
Yes | Yes | No | ||||||||
As far as I’m concerned this event should also fire when the user selects text in any element. No browser agrees, though. | |||||||||||||||
When the user submits a form. |
Yes | Yes | Yes | Yes | Yes | Yes | |||||||||
Event | IE 5.5 | IE 6 | IE 7 | IE8rc1 as IE7 | IE8rc1 as IE8 | FF 2.0 | FF 3.0 | FF 3.1b2 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Chrome 1.0 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 |
W3C events
The events below do not work with traditional event registration. You have to use addEventListener
in order to capture these events.
I don’t understand why this should be so; it breaks the ancient and reliable rule that any event is available in any registration model.
The camelcase-like event names are required. Here, too, an old rule is broken: all other event names are strictly lower case.
Event | IE 5.5 | IE 6 | IE 7 | IE8rc1 as IE7 | IE8rc1 as IE8 | FF 2.0 | FF 3.0 | FF 3.1b2 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Chrome 1.0 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DOMActivate
Should fire when an element is activated. |
No | Yes | Incor |
No | Incor | ||||||||||
A link is activated when the user follows it. A checkbox or radio is activated when it is checked or unchecked.
| |||||||||||||||
DOMAttrModified
An attribute in the DOM tree of the element has been changed. |
No | Yes | No | No | Yes | No | |||||||||
| |||||||||||||||
DOMCharacter
Text in the DOM tree of the element has been changed. |
No | Incom |
Incom |
Yes | Yes | Incom |
Incom | ||||||||
| |||||||||||||||
Event | IE 5.5 | IE 6 | IE 7 | IE8rc1 as IE7 | IE8rc1 as IE8 | FF 2.0 | FF 3.0 | FF 3.1b2 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Chrome 1.0 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 |
DOMFocusIn
As focus, but bubbles. |
No | No | No | Incom |
Almost | Yes | Yes | ||||||||
| |||||||||||||||
DOMFocusOut
As blur, but bubbles. |
No | No | No | Incom |
Almost | Yes | Yes | ||||||||
| |||||||||||||||
DOMMouseScroll
When the user uses the mouse wheel. |
No | Yes | No | Untest |
No | No | No | ||||||||
Equivalent of mousewheel. | |||||||||||||||
DOMNodeInserted
A new node has been inserted into the DOM tree of the element. |
No | Yes | Yes | Yes | Yes | Incom | |||||||||
If you change an element’s
| |||||||||||||||
Event | IE 5.5 | IE 6 | IE 7 | IE8rc1 as IE7 | IE8rc1 as IE8 | FF 2.0 | FF 3.0 | FF 3.1b2 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Chrome 1.0 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 |
DOMNodeRemoved
A node has been removed from the DOM tree of the element. |
No | Yes | Too many | Too many | Yes | Incom | |||||||||
If you change an element’s
| |||||||||||||||
DOMSubtreeModified
The most generic event: something in the DOM tree of the element has changed. |
No | No | Yes | Yes | Yes | No | Yes | ||||||||
textInput
Equivalent of keypress. |
No | No | Yes | Yes | No | No | |||||||||
This is a DOM event, despite the "DOM" bit missing in the name. Therefore it does not work with traditional event registration. | |||||||||||||||
Event | IE 5.5 | IE 6 | IE 7 | IE8rc1 as IE7 | IE8rc1 as IE8 | FF 2.0 | FF 3.0 | FF 3.1b2 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Chrome 1.0 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 |
Microsoft events
Event | IE 5.5 | IE 6 | IE 7 | IE8rc1 as IE7 | IE8rc1 as IE8 | FF 2.0 | FF 3.0 | FF 3.1b2 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Chrome 1.0 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
activate
Despite the name this event is an equivalent of focusin. |
Yes | No | No | No | No | No | |||||||||
beforecopy
|
Yes | No | No | Yes | Untest |
Yes | No | No | |||||||
I do not understand the real purpose of these events. However, when the user calls up a context menu that contains cut, copy and paste actions, beforecut, beforecopy and beforepaste all fire. | |||||||||||||||
beforecut
|
Yes | No | No | Yes | Untest |
Yes | No | No | |||||||
See beforecopy. | |||||||||||||||
beforepaste
|
Yes | No | No | Incom |
Untest |
Incom |
No | No | |||||||
See beforecopy.
| |||||||||||||||
Event | IE 5.5 | IE 6 | IE 7 | IE8rc1 as IE7 | IE8rc1 as IE8 | FF 2.0 | FF 3.0 | FF 3.1b2 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Chrome 1.0 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 |
deactivate
Despite the name this event is an equivalent of focusout. |
Yes | No | No | No | No | No | |||||||||
focusin
As focus, but bubbles. |
No | Yes | No | No | No | No | No | ||||||||
Not available on the window. | |||||||||||||||
focusout
As blur, but bubbles. |
No | Yes | No | No | No | No | No | ||||||||
Not available on the window. | |||||||||||||||
hashchange
When the hash value of the location changes. |
No | Yes | No | No | No | No | No | ||||||||
This event might be interesting for monitoring Back/Forward in Ajax interfaces. | |||||||||||||||
Event | IE 5.5 | IE 6 | IE 7 | IE8rc1 as IE7 | IE8rc1 as IE8 | FF 2.0 | FF 3.0 | FF 3.1b2 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Chrome 1.0 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 |
mouseenter
When the mouse enters an element, but it doesn’t bubble. MUCH more useful than mouseover. Come on, Mozilla. Come on, Apple. Come on, Google. Come on, Opera. Come on, KDE. |
Yes | No | No | No | No | No | |||||||||
The other browsers should implement these events as soon as possible. (Yes, I know I’m shouting, but I’ve been saying this since 2003 and nobody has ever paid my message the least attention.) Mouseover and mouseout also fire when the user mouses over or out of a child element of the element you registered the events on. Mouseenter and mouseleave don’t. Thus, they are the true equivalent of CSS Once these events are supported by all browsers, creating dropdown menus will become a walk in the park. It’s Firefox’s, Safari’s and Opera’s fault that we still have to waste hours and hours on carefully distinguishing between important and unimportant mouseover and mouseout events. If we just had mouseenter and mouseleave, all our problems would be solved. | |||||||||||||||
mouseleave
When the mouse leaves an element, but it doesn’t bubble. MUCH more useful than mouseout. |
Yes | No | No | No | No | No | |||||||||
See mouseenter remarks. | |||||||||||||||
Event | IE 5.5 | IE 6 | IE 7 | IE8rc1 as IE7 | IE8rc1 as IE8 | FF 2.0 | FF 3.0 | FF 3.1b2 | Saf 3.0 Win | Saf 3.1 Win | iPhone 3G | Chrome 1.0 | Opera 9.62 | Opera 10a | Konqueror 3.5.7 |