X-Git-Url: http://git.asbjorn.biz/?p=jquery.git;a=blobdiff_plain;f=test%2Funit%2Fevent.js;h=e4caee82a54982d0c0017ac16d59cdff6352272b;hp=a6d8cb68bb0963b2c1dbd6a06cbc9433738f16e1;hb=328a86f9a0d3f0907cc950f7543e34cb3efbda3f;hpb=e2941d5a98e91c5f61b200b2763e5fa0eb339365 diff --git a/test/unit/event.js b/test/unit/event.js index a6d8cb6..e4caee8 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -304,15 +304,15 @@ test("live/delegate immediate propagation", function() { $p.undelegate( "click" ); }); -test("bind/delegate bubbling, isDefaultPrevented (Bug #7793)", function() { +test("bind/delegate bubbling, isDefaultPrevented", function() { expect(2); var $anchor2 = jQuery( "#anchor2" ), $main = jQuery( "#main" ), fakeClick = function($jq) { // Use a native click so we don't get jQuery simulated bubbling if ( document.createEvent ) { - var e = document.createEvent( "MouseEvents" ); - e.initEvent( "click", true, true ); + var e = document.createEvent( 'MouseEvents' ); + e.initEvent( "click", true, true ); $jq[0].dispatchEvent(e); } else if ( $jq[0].click ) { @@ -323,7 +323,15 @@ test("bind/delegate bubbling, isDefaultPrevented (Bug #7793)", 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" ); @@ -1945,26 +1953,6 @@ test("window resize", function() { ok( !jQuery._data(window, "__events__"), "Make sure all the events are gone." ); }); -test("focusin bubbles", function() { - //create an input and focusin on it - var input = jQuery(""), order = 0; - - input.prependTo("body"); - - jQuery("body").bind("focusin.focusinBubblesTest",function(){ - equals(1,order++,"focusin on the body second") - }); - - input.bind("focusin.focusinBubblesTest",function(){ - equals(0,order++,"focusin on the element first") - }); - - input[0].focus(); - input.remove(); - - jQuery("body").unbind("focusin.focusinBubblesTest"); -}); - /* test("jQuery(function($) {})", function() { stop();