if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
+
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
- this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
+ this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
+
// Event type
} else {
this.type = src;
e.preventDefault();
});
$main.delegate("#foo", "click", function(e) {
- equals( e.isDefaultPrevented(), true, "isDefaultPrevented true passed to bubbled event" );
+ var orig = e.originalEvent;
++
+ if ( typeof(orig.defaultPrevented) === "boolean" || typeof(orig.returnValue) === "boolean" || orig.getPreventDefault ) {
+ equals( e.isDefaultPrevented(), true, "isDefaultPrevented true passed to bubbled event" );
- }
- else {
++
++ } else {
+ // Opera < 11 doesn't implement any interface we can use, so give it a pass
+ ok( true, "isDefaultPrevented not supported by this browser, test skipped" );
+ }
});
fakeClick( $anchor2 );
$anchor2.unbind( "click" );