From 55b658ac577d04d19ad2ee2b463681dc3d630642 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Fri, 18 May 2007 01:44:26 +0000 Subject: [PATCH] prototype: Event.findElement now uses Element#up (and as a result can take a CSS selector instead of just a tag name). --- CHANGELOG | 2 ++ src/event.js | 10 ++-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index da7662b..7dc1131 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Event.findElement now uses Element#up (and as a result can take a CSS selector instead of just a tag name). [Tobie Langel] + * Minor cleanup of the position methods [sam] * Fix Element#clonePosition to call viewportOffset. Closes #8372. [graemenelson, Christophe Porteneuve] diff --git a/src/event.js b/src/event.js index 4bdfc2b..499a239 100644 --- a/src/event.js +++ b/src/event.js @@ -46,14 +46,8 @@ Object.extend(Event, { } }, - // find the first node with the given tagName, starting from the - // node the event was triggered on; traverses the DOM upwards - findElement: function(event, tagName) { - var element = Event.element(event); - while (element.parentNode && (!element.tagName || - (element.tagName.toUpperCase() != tagName.toUpperCase()))) - element = element.parentNode; - return element; + findElement: function(event, expression) { + return Event.element(event).up(expression); }, observers: false,