diff --git a/CHANGELOG b/CHANGELOG index e08a3df..dc1c89c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/src/dom/event.js b/src/dom/event.js index 5e56184..3a08d6c 100644 --- a/src/dom/event.js +++ b/src/dom/event.js @@ -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;