From 0b7d1e6e1e1bc6ddb0d304c6518ea6019d67f15a Mon Sep 17 00:00:00 2001 From: Schuyler Erle Date: Wed, 24 May 2006 03:14:05 +0000 Subject: [PATCH] Bug fix and comments to Util.mouseLeft(). git-svn-id: http://svn.openlayers.org/trunk/openlayers@307 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Util.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 58367baa9b..9b2121af9e 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -758,9 +758,12 @@ OpenLayers.Util.getTagText = function (parent, item, index) { * @return {boolean} */ OpenLayers.Util.mouseLeft = function (evt, div) { + // start with the element to which the mouse has moved var target = (evt.relatedTarget) ? evt.relatedTarget : evt.toElement; - while (target != div && target.nodeName != 'BODY') { + // walk up the DOM tree. + while (target != div && target != document.documentElement) { target = target.parentNode; } - return (target == div); + // if the target we stop at isn't the div, then we've left the div. + return (target != div); };