]> source.dussan.org Git - jquery.git/commitdiff
Update test case to feature-detect Opera's lack of defaultPrevented and skip the... 183/head
authorDave Methvin <dave.methvin@gmail.com>
Sat, 15 Jan 2011 15:24:13 +0000 (10:24 -0500)
committerDave Methvin <dave.methvin@gmail.com>
Sat, 15 Jan 2011 15:24:13 +0000 (10:24 -0500)
test/unit/event.js

index 56bc64ff6a0dfbfba64f5b1853fe52da0321b117..d5d6790d4450a7c1ac14240d3a0861358067d3a3 100644 (file)
@@ -314,7 +314,14 @@ test("bind/delegate bubbling, isDefaultPrevented", function() {
                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 {
+                       // 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" );