Do not sniff when testing for IE's proprietary mouseenter/mouseleave events support. Use more robust inference instead.

This commit is contained in:
Juriy Zaytsev 2009-03-28 19:45:33 -04:00
parent fd46f6bbcf
commit c480bd7b97
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,5 @@
* Do not sniff when testing for IE's proprietary mouseenter/mouseleave events support. Use more robust inference instead. (kangax)
* Use `Prototype.emptyFunction` consistently throughout unit tests. [#253 state:resolved] (Michael M Slusarz, John David Dalton, kangax)
* deprecation extension: mark Array#reduce() as removed. [#569 state:resolved] (Tobie Langel)

View File

@ -49,6 +49,10 @@
cache: {}
};
var docEl = document.documentElement;
var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl
&& 'onmouseleave' in docEl;
var _isButton;
if (Prototype.Browser.IE) {
@ -320,7 +324,7 @@
};
} else {
// Non-custom event.
if (!Prototype.Browser.IE &&
if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED &&
(eventName === "mouseenter" || eventName === "mouseleave")) {
// If we're dealing with mouseenter or mouseleave in a non-IE browser,
// we create a custom responder that mimics their behavior within
@ -376,7 +380,7 @@
var _getDOMEventName = Prototype.K;
if (!Prototype.Browser.IE) {
if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) {
_getDOMEventName = function(eventName) {
var translations = { mouseenter: "mouseover", mouseleave: "mouseout" };
return eventName in translations ? translations[eventName] : eventName;