diff options
-rw-r--r-- | actionpack/lib/action_view/helpers/javascripts/prototype.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/helpers/javascripts/prototype.js b/actionpack/lib/action_view/helpers/javascripts/prototype.js index bba61b91a0..02d103498e 100644 --- a/actionpack/lib/action_view/helpers/javascripts/prototype.js +++ b/actionpack/lib/action_view/helpers/javascripts/prototype.js @@ -797,9 +797,9 @@ 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) { - element = Event.element(event); - while (element.tagName.toUpperCase() != tagName.toUpperCase() - && element.parentNode) + var element = Event.element(event); + while (element.parentNode && (!element.tagName || + (element.tagName.toUpperCase() != tagName.toUpperCase()))) element = element.parentNode; return element; }, |