Skip to content
Permalink
Browse files

Make sure that we don't try to trigger non-existant native events on …

…applets, embed, objects, etc. as it'll cause an exception with Java applets. Fixes #2414.
  • Loading branch information
jeresig committed Dec 9, 2009
1 parent 1052792 commit 3ec2f1aef6b137d0f639e2fc53f95352d24b9d90
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/event.js
@@ -253,8 +253,10 @@ jQuery.event = {

var nativeFn, nativeHandler;
try {
nativeFn = elem[ type ];
nativeHandler = elem[ "on" + type ];
if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
nativeFn = elem[ type ];
nativeHandler = elem[ "on" + type ];
}
// prevent IE from throwing an error for some elements with some event types, see #3533
} catch (e) {}

3 comments on commit 3ec2f1a

@pseudosavant

This comment has been minimized.

Copy link

pseudosavant replied Oct 26, 2010

Could/can this functionality easily be disabled at runtime? I found out about this aspect of jQuery when I was trying to use it with events on non-Java plugins. It would be nice if there was a way to override this functionality without having to host/build my own copy of jQuery that doesn't have this behavior.

@jeresig

This comment has been minimized.

Copy link
Member Author

jeresig replied Oct 26, 2010

We are enabled for Flash plugins in 1.4.3. If you want to allow it to run anyway then just override jQuery.noData with the appropriate set of elements that you do/don't want data to be attached to.

@pseudosavant

This comment has been minimized.

Copy link

pseudosavant replied Oct 26, 2010

Thanks for the tip and quick response! I'll try that out.

Please sign in to comment.
You can’t perform that action at this time.