prototype: Event.findElement now uses Element#up (and as a result can take a CSS selector instead of just a tag name).

This commit is contained in:
Sam Stephenson 2007-05-18 01:44:26 +00:00
parent a8a19eb439
commit 55b658ac57
2 changed files with 4 additions and 8 deletions

View File

@ -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]

View File

@ -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,