Skip to main content

Bug Tracker

Side navigation

Ticket #5514: withinElement.js
File withinElement.js, 0.7 KB (added by R, November 14, 2009 10:28PM UTC)

updated withinElement function

var withinElement = function( event ) {
	// Check if mouse(over|out) are still within the same parent element
	var parent = event.relatedTarget;
	// Firefox sometimes assigns relatedTarget a XUL element
	// which we cannot access the parentNode property of
	try {
		// Traverse up the tree
		while ( parent && parent !== this ) {
			parent = parent.parentNode;
		}
	} catch(e){
		parent = this; // jQuery 1.3.2 behavior. In latest nighlty skip this line
	}

	if ( parent != this ) {
		// set the correct event type
		event.type = event.data;
		// handle event if we actually just moused on to a non sub-element
		jQuery.event.handle.apply( this, arguments );
	}
};

Download in other formats:

Original Format