diff --git a/src/dom/event.js b/src/dom/event.js index 84fda31..8158eff 100644 --- a/src/dom/event.js +++ b/src/dom/event.js @@ -149,8 +149,12 @@ function findElement(event, expression) { var element = Event.element(event); if (!expression) return element; - var elements = [element].concat(element.ancestors()); - return Prototype.Selector.find(elements, expression, 0); + while (element) { + if (Prototype.Selector.match(element, expression)) { + return Element.extend(element); + } + element = element.parentNode; + } } /**