Allow the optional overriding of target in DomEvent.getOffset().

This commit is contained in:
Jürg Lehni 2011-06-21 00:37:26 +01:00
parent f6fdbd349d
commit 8361f513ed

View file

@ -58,10 +58,10 @@ var DomEvent = {
return event.target || event.srcElement; return event.target || event.srcElement;
}, },
getOffset: function(event) { getOffset: function(event, target) {
// Remove target offsets from page coordinates // Remove target offsets from page coordinates
return DomEvent.getPoint(event).subtract( return DomEvent.getPoint(event).subtract(
DomElement.getOffset(DomEvent.getElement(event), true)); DomElement.getOffset(target || DomEvent.getElement(event), true));
}, },
preventDefault: function(event) { preventDefault: function(event) {