Fix #12569. Improve feature detect for event bubbling. Close gh-1076.

This commit is contained in:
Oleg
2012-12-17 18:17:39 +04:00
committed by Dave Methvin
parent 00bbbe2075
commit c8c6ab6924
4 changed files with 180 additions and 86 deletions

View File

@@ -1,4 +1,7 @@
<?php header("X-Content-Security-Policy-Report-Only: allow *"); ?>
<?php
header("X-Content-Security-Policy: default-src localhost 'self';");
header("X-WebKit-CSP: script-src 'self'; style-src 'self' 'unsafe-inline'");
?>
<!DOCTYPE html>
<html>
<head>

View File

@@ -2601,3 +2601,31 @@ test( "make sure events cloned correctly", 18, function() {
clone.find("p:first").click(); // 0 should be fired
clone.find("#check1").change(); // 0 events should fire
});
test( "Check order of focusin/focusout events", 2, function() {
var focus, blur,
input = jQuery("#name");
input.on("focus", function() {
focus = true;
}).on("focusin", function() {
ok( !focus, "Focusin event should fire before focus does" );
}).on("blur", function() {
blur = true;
}).on("focusout", function() {
ok( !blur, "Focusout event should fire before blur does" );
});
// gain focus
input.focus();
// then lose it
jQuery("#search").focus();
// cleanup
input.off();
});

View File

@@ -7,7 +7,7 @@ test("boxModel", function() {
});
if ( jQuery.css ) {
testIframeWithCallback( "body background is not lost if set prior to loading jQuery (#9238)", "support/bodyBackground.html", function( color, support ) {
testIframeWithCallback( "body background is not lost if set prior to loading jQuery (#9239)", "support/bodyBackground.html", function( color, support ) {
expect( 2 );
var i,
passed = true,
@@ -29,6 +29,7 @@ if ( jQuery.css ) {
strictEqual( jQuery.support[ i ], support[ i ], "Unexpected property: " + i );
}
}
ok( passed, "Same support properties" );
});
}
@@ -44,13 +45,12 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
});
(function() {
var userAgent = window.navigator.userAgent,
expected;
var expected,
userAgent = window.navigator.userAgent;
// These tests do not have to stay
// They are here to help with upcoming support changes for 1.8
if ( /chrome\/19\.0/i.test(userAgent) ) {
if ( /chrome/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":true,
"tbody":true,
@@ -83,7 +83,106 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"cors":true,
"doesNotIncludeMarginInBodyOffset":true
};
} else if ( /msie 8\.0/i.test(userAgent) ) {
} else if ( /opera/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":true,
"tbody":true,
"htmlSerialize":true,
"style":true,
"hrefNormalized":true,
"opacity":true,
"cssFloat":true,
"checkOn":true,
"optSelected":true,
"getSetAttribute":true,
"enctype":true,
"html5Clone":true,
"submitBubbles":true,
"changeBubbles":true,
"focusinBubbles":false,
"deleteExpando":true,
"noCloneEvent":true,
"inlineBlockNeedsLayout":false,
"shrinkWrapBlocks":false,
"reliableMarginRight":true,
"noCloneChecked":true,
"optDisabled":true,
"radioValue":false,
"checkClone":true,
"appendChecked":true,
"boxModel":true,
"reliableHiddenOffsets":true,
"ajax":true,
"cors":true,
"doesNotIncludeMarginInBodyOffset":true
};
} else if ( /msie 10\.0/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":true,
"tbody":true,
"htmlSerialize":true,
"style":true,
"hrefNormalized":true,
"opacity":true,
"cssFloat":true,
"checkOn":true,
"optSelected":false,
"getSetAttribute":true,
"enctype":true,
"html5Clone":true,
"submitBubbles":true,
"changeBubbles":true,
"focusinBubbles":true,
"deleteExpando":true,
"noCloneEvent":true,
"inlineBlockNeedsLayout":false,
"shrinkWrapBlocks":false,
"reliableMarginRight":true,
"noCloneChecked":false,
"optDisabled":true,
"radioValue":false,
"checkClone":true,
"appendChecked":true,
"boxModel":true,
"reliableHiddenOffsets":true,
"ajax":true,
"cors":true,
"doesNotIncludeMarginInBodyOffset":true
};
} else if ( /msie 9\.0/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":true,
"tbody":true,
"htmlSerialize":true,
"style":true,
"hrefNormalized":true,
"opacity":true,
"cssFloat":true,
"checkOn":true,
"optSelected":false,
"getSetAttribute":true,
"enctype":true,
"html5Clone":true,
"submitBubbles":true,
"changeBubbles":true,
"focusinBubbles":true,
"deleteExpando":true,
"noCloneEvent":true,
"inlineBlockNeedsLayout":false,
"shrinkWrapBlocks":false,
"reliableMarginRight":true,
"noCloneChecked":false,
"optDisabled":true,
"radioValue":false,
"checkClone":true,
"appendChecked":true,
"boxModel":true,
"reliableHiddenOffsets":true,
"ajax":true,
"cors":false,
"doesNotIncludeMarginInBodyOffset":true
};
} else if ( /msie 8\.0/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":false,
"tbody":true,
@@ -116,7 +215,7 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"cors":false,
"doesNotIncludeMarginInBodyOffset":true
};
} else if ( /msie 7\.0/i.test(userAgent) ) {
} else if ( /msie 7\.0/i.test( userAgent ) ) {
expected = {
"ajax": true,
"appendChecked": false,
@@ -149,7 +248,7 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"tbody": false,
"style": false
};
} else if ( /msie 6\.0/i.test(userAgent) ) {
} else if ( /msie 6\.0/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":false,
"tbody":false,
@@ -182,7 +281,7 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"cors":false,
"doesNotIncludeMarginInBodyOffset":true
};
} else if ( /5\.1\.1 safari/i.test(userAgent) ) {
} else if ( /5\.1\.1 safari/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":true,
"tbody":true,
@@ -215,7 +314,7 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"cors":true,
"doesNotIncludeMarginInBodyOffset":true
};
} else if ( /firefox\/3\.6/i.test(userAgent) ) {
} else if ( /firefox/i.test( userAgent ) ) {
expected = {
"leadingWhitespace":true,
"tbody":true,
@@ -227,7 +326,7 @@ testIframeWithCallback( "box-sizing does not affect jQuery.support.shrinkWrapBlo
"checkOn":true,
"optSelected":true,
"getSetAttribute":true,
"enctype":false,
"enctype":true,
"html5Clone":true,
"submitBubbles":true,
"changeBubbles":true,