Showing with 76 additions and 9 deletions.
  1. +1 −1 src/ajax/load.js
  2. +1 −1 src/core.js
  3. +3 −2 src/core/ready.js
  4. +2 −2 src/css.js
  5. +1 −1 src/event.js
  6. +24 −0 test/data/core/onready.html
  7. +18 −0 test/data/event/triggerunload.html
  8. +1 −0 test/data/test3.html
  9. +8 −0 test/unit/ajax.js
  10. +10 −1 test/unit/core.js
  11. +2 −1 test/unit/css.js
  12. +5 −0 test/unit/event.js
@@ -25,7 +25,7 @@ jQuery.fn.load = function( url, params, callback ) {
off = url.indexOf(" ");

if ( off >= 0 ) {
selector = url.slice( off );
selector = jQuery.trim( url.slice( off ) );
url = url.slice( 0, off );
}

@@ -216,7 +216,7 @@ jQuery.extend({
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
return obj - parseFloat( obj ) >= 0;
return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0;
},

isPlainObject: function( obj ) {
@@ -51,8 +51,9 @@ jQuery.extend({
readyList.resolveWith( document, [ jQuery ] );

// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger("ready").off("ready");
if ( jQuery.fn.triggerHandler ) {
jQuery( document ).triggerHandler( "ready" );
jQuery( document ).off( "ready" );
}
}
});
@@ -29,8 +29,8 @@ var

cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
letterSpacing: 0,
fontWeight: 400
letterSpacing: "0",
fontWeight: "400"
},

cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
@@ -583,7 +583,7 @@ jQuery.event = {

// Support: Firefox 20+
// Firefox doesn't alert if the returnValue field is not set.
if ( event.result !== undefined ) {
if ( event.result !== undefined && event.originalEvent ) {
event.originalEvent.returnValue = event.result;
}
}
@@ -0,0 +1,24 @@
<!doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>alias-masked DOM properties (#14074)</title>
<script>
var error = false;
window.onready = function() { error = "Called window.onready"; };
</script>
<script src="../../jquery.js"></script>
</head>
<body>
<form>
<input type="text" id="nodeName"/>
</form>
<script>
jQuery(function() {
setTimeout( function() {
window.parent.iframeCallback( error );
});
});
</script>
</body>
</html>
@@ -0,0 +1,18 @@
<!doctype html>
<html>
<script src="../../jquery.js"></script>
<script>
var called = false,
error = false;

window.onerror = function() { error = true; };

jQuery( window ).on( "beforeunload", function( event ) {
called = true;
return "maybe";
}).on( "load", function( event ) {
$( window ).triggerHandler( "beforeunload" );
window.parent.iframeCallback( called && !error );
});
</script>
</html>
@@ -1,3 +1,4 @@
<div class="user">This is a user</div>
<div class="user">This is a user</div>
<div class="teacher">This is a teacher</div>
<div id="superuser">This is a superuser</div>
@@ -1807,6 +1807,14 @@ module( "ajax", {
});
});

// Selector should be trimmed to avoid leading spaces (#14773)
asyncTest( "jQuery.fn.load( URL_SELECTOR with spaces )", 1, function() {
jQuery("#first").load( "data/test3.html #superuser ", function() {
strictEqual( jQuery( this ).children("div").length, 1, "Verify that specific elements were injected" );
start();
});
});

asyncTest( "jQuery.fn.load( String, Function ) - simple: inject text into DOM", 2, function() {
jQuery("#first").load( url("data/name.html"), function() {
ok( /^ERROR/.test(jQuery("#first").text()), "Check if content was injected into the DOM" );
@@ -457,7 +457,7 @@ test("isFunction", function() {
});

test( "isNumeric", function() {
expect( 36 );
expect( 38 );

var t = jQuery.isNumeric,
Traditionalists = /** @constructor */ function(n) {
@@ -505,6 +505,8 @@ test( "isNumeric", function() {
equal( t(Number.NEGATIVE_INFINITY), false, "Negative Infinity");
equal( t(rong), false, "Custom .toString returning non-number");
equal( t({}), false, "Empty object");
equal( t( [] ), false, "Empty array" );
equal( t( [ 42 ] ), false, "Array with one number" );
equal( t(function(){} ), false, "Instance of a function");
equal( t( new Date() ), false, "Instance of a Date");
equal( t(function(){} ), false, "Instance of a function");
@@ -1514,3 +1516,10 @@ testIframeWithCallback( "Tolerating alias-masked DOM properties (#14074)", "core
deepEqual( errors, [], "jQuery loaded" );
}
);

testIframeWithCallback( "Don't call window.onready (#14802)", "core/onready.html",
function( error ) {
expect( 1 );
equal( error, false, "no call to user-defined onready" );
}
);
@@ -813,12 +813,13 @@ testIframeWithCallback( "css('width') should work correctly before document read
);

test("certain css values of 'normal' should be convertable to a number, see #8627", function() {
expect ( 2 );
expect ( 3 );

var el = jQuery("<div style='letter-spacing:normal;font-weight:normal;'>test</div>").appendTo("#qunit-fixture");

ok( jQuery.isNumeric( parseFloat( el.css("letterSpacing") ) ), "css('letterSpacing') not convertable to number, see #8627" );
ok( jQuery.isNumeric( parseFloat( el.css("fontWeight") ) ), "css('fontWeight') not convertable to number, see #8627" );
equal( typeof el.css( "fontWeight" ), "string", ".css() returns a string" );
});

// only run this test in IE9
@@ -2434,6 +2434,11 @@ testIframeWithCallback( "Focusing iframe element", "event/focusElem.html", funct
ok( isOk, "Focused an element in an iframe" );
});

testIframeWithCallback( "triggerHandler(onbeforeunload)", "event/triggerunload.html", function( isOk ) {
expect( 1 );
ok( isOk, "Triggered onbeforeunload without an error" );
});

// need PHP here to make the incepted IFRAME hang
if ( hasPHP ) {
testIframeWithCallback( "jQuery.ready synchronous load with long loading subresources", "event/syncReady.html", function( isOk ) {