Fix Event#element throwing errors for events missing a currentTarget.
This commit is contained in:
parent
41ef42e033
commit
6416d28080
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue