From: Dave Methvin Date: Sat, 15 Jan 2011 15:24:13 +0000 (-0500) Subject: Update test case to feature-detect Opera's lack of defaultPrevented and skip the... X-Git-Tag: 1.5rc1~55^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=007e2d152e10a8feffa347b5f328d2cb4bd45327;p=jquery.git Update test case to feature-detect Opera's lack of defaultPrevented and skip the test for it. --- diff --git a/test/unit/event.js b/test/unit/event.js index 56bc64ff6..d5d6790d4 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -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" );