From 6416d28080e2d7fdc9726670329a840eb16b6b72 Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Tue, 9 Sep 2008 11:57:59 -0700 Subject: [PATCH] Fix Event#element throwing errors for events missing a currentTarget. --- src/event.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/event.js b/src/event.js index cfee8af..20657a9 100644 --- a/src/event.js +++ b/src/event.js @@ -63,15 +63,14 @@ Event.Methods = (function() { var node = event.target, type = event.type, - currentTarget = event.currentTarget, - tagName = currentTarget.tagName; + currentTarget = event.currentTarget; - if (currentTarget && tagName) { + if (currentTarget && currentTarget.tagName) { // Firefox screws up the "click" event when moving between radio buttons // via arrow keys. It also screws up the "load" and "error" events on images, // reporting the document as the target instead of the original image. if (type === 'load' || type === 'error' || - (type === 'click' && tagName.toLowerCase() === 'input' + (type === 'click' && currentTarget.tagName.toLowerCase() === 'input' && currentTarget.type === 'radio')) node = currentTarget; }