@@ -42,7 +42,7 @@ QUnit.test( "jQuery()", function( assert ) {
}
if ( jQuery.fn.offset ) {
expected++;
attrObj["offset"] = { "top": 1, "left": 1 };
attrObj[ "offset" ] = { "top": 1, "left": 1 };
}
if ( jQuery.fn.css ) {
expected += 2;
@@ -57,12 +57,12 @@ QUnit.test( "jQuery()", function( assert ) {

// Basic constructor's behavior
equal( jQuery().length, 0, "jQuery() === jQuery([])" );
equal( jQuery(undefined).length, 0, "jQuery(undefined) === jQuery([])" );
equal( jQuery(null).length, 0, "jQuery(null) === jQuery([])" );
equal( jQuery("").length, 0, "jQuery('') === jQuery([])" );
equal( jQuery("#").length, 0, "jQuery('#') === jQuery([])" );
equal( jQuery( undefined ).length, 0, "jQuery(undefined) === jQuery([])" );
equal( jQuery( null ).length, 0, "jQuery(null) === jQuery([])" );
equal( jQuery( "" ).length, 0, "jQuery('') === jQuery([])" );
equal( jQuery( "#" ).length, 0, "jQuery('#') === jQuery([])" );

equal( jQuery(obj).selector, "div", "jQuery(jQueryObj) == jQueryObj" );
equal( jQuery( obj ).selector, "div", "jQuery(jQueryObj) == jQueryObj" );

// can actually yield more than one, when iframes are included, the window is an array as well
assert.equal( jQuery( window ).length, 1, "Correct number of elements generated for jQuery(window)" );
@@ -94,7 +94,7 @@ QUnit.test( "jQuery()", function( assert ) {
assert.equal( div.length, 4, "Correct number of elements generated for div hr code b" );
assert.equal( div.parent().length, 0, "Make sure that the generated HTML has no parent." );

assert.equal( jQuery( [ 1,2,3 ] ).get( 1 ), 2, "Test passing an array to the factory" );
assert.equal( jQuery( [ 1, 2, 3 ] ).get( 1 ), 2, "Test passing an array to the factory" );

assert.equal( jQuery( document.body ).get( 0 ), jQuery( "body" ).get( 0 ), "Test passing an html node to the factory" );

@@ -104,7 +104,7 @@ QUnit.test( "jQuery()", function( assert ) {
elem = jQuery( "\n\n<em>world</em>" )[ 0 ];
assert.equal( elem.nodeName.toLowerCase(), "em", "leading newlines" );

elem = jQuery("<div/>", attrObj );
elem = jQuery( "<div/>", attrObj );

if ( jQuery.fn.width ) {
assert.equal( elem[ 0 ].style.width, "10px", "jQuery() quick setter width" );
@@ -115,7 +115,7 @@ QUnit.test( "jQuery()", function( assert ) {
}

if ( jQuery.fn.offset ) {
equal( elem[0].style.top, "1px", "jQuery() quick setter offset");
equal( elem[ 0 ].style.top, "1px", "jQuery() quick setter offset" );
}

if ( jQuery.fn.css ) {
@@ -172,11 +172,11 @@ test( "selector state", function() {
equal( test.selector, "", "Body Selector" );
equal( test.context, document.body, "Body Context" );

test = jQuery("#qunit-fixture");
test = jQuery( "#qunit-fixture" );
equal( test.selector, "#qunit-fixture", "#qunit-fixture Selector" );
equal( test.context, document, "#qunit-fixture Context" );

test = jQuery("#notfoundnono");
test = jQuery( "#notfoundnono" );
equal( test.selector, "#notfoundnono", "#notfoundnono Selector" );
equal( test.context, document, "#notfoundnono Context" );

@@ -193,14 +193,14 @@ test( "selector state", function() {
equal( test.selector, "#qunit-fixture", "#qunit-fixture Selector" );
equal( test.context, document.body, "#qunit-fixture Context" );

test = jQuery( document.body ).find("#qunit-fixture");
test = jQuery( document.body ).find( "#qunit-fixture" );
equal( test.selector, "#qunit-fixture", "#qunit-fixture find Selector" );
equal( test.context, document.body, "#qunit-fixture find Context" );
});
} );

QUnit.test( "globalEval", function( assert ) {
expect( 2 );
Globals.register("globalEvalTest");
Globals.register( "globalEvalTest" );

jQuery.globalEval( "var globalEvalTest = 2;" );
assert.equal( window.globalEvalTest, 2, "Test variable declarations are global" );
@@ -314,8 +314,9 @@ QUnit.test( "type", function( assert ) {
} );

QUnit.test( "type for `Symbol`", function( assert ) {

// Prevent reference errors
if( typeof Symbol !== "function" ) {
if ( typeof Symbol !== "function" ) {
assert.expect( 0 );
return;
}
@@ -324,7 +325,7 @@ QUnit.test( "type for `Symbol`", function( assert ) {

assert.equal( jQuery.type( Symbol() ), "symbol", "Symbol" );
assert.equal( jQuery.type( Object( Symbol() ) ), "symbol", "Symbol" );
});
} );

QUnit.asyncTest( "isPlainObject", function( assert ) {
assert.expect( 16 );
@@ -412,7 +413,6 @@ QUnit[ typeof Symbol === "function" ? "test" : "skip" ]( "isPlainObject(Symbol)"
assert.equal( jQuery.isPlainObject( Object( Symbol() ) ), false, "Symbol inside an object" );
} );


QUnit.test( "isFunction", function( assert ) {
assert.expect( 19 );

@@ -963,7 +963,7 @@ QUnit.test( "jQuery.map", function( assert ) {
assert.ok( !result, "empty NodeList treated like array" );

result = jQuery.map( Array( 4 ), function( v, k ) {
return k % 2 ? k : [ k,k,k ];
return k % 2 ? k : [ k, k, k ];
} );
assert.equal( result.join( "" ), "00012223", "Array results flattened (#2616)" );
} );
@@ -1115,7 +1115,7 @@ QUnit.test( "jQuery.grep(Array-like)", function( assert ) {
[],
"Satisfying elements absent, Array-like object used, and grep explicitly uninverted"
);
});
} );

QUnit.test( "jQuery.extend(Object, Object)", function( assert ) {
assert.expect( 28 );
@@ -1240,19 +1240,19 @@ QUnit.test( "jQuery.extend(Object, Object {created with \"defineProperties\"})",

assert.expect( 2 );

var definedObj = Object.defineProperties({}, {
var definedObj = Object.defineProperties( {}, {
"enumerableProp": {
get: function () {
get: function() {
return true;
},
enumerable: true
},
"nonenumerableProp": {
get: function () {
get: function() {
return true;
}
}
}),
} ),
accessorObj = {};

jQuery.extend( accessorObj, definedObj );
@@ -1287,7 +1287,7 @@ QUnit.test( "jQuery.each(Object,Function)", function( assert ) {
assert.deepEqual( seen, [ 1, 2 ], "Broken array iteration" );

seen = [];
jQuery.each( { "a": 1, "b": 2,"c": 3 }, function( k, v ) {
jQuery.each( { "a": 1, "b": 2, "c": 3 }, function( k, v ) {
seen.push( v );
return false;
} );
@@ -1407,7 +1407,7 @@ QUnit.test( "jQuery.makeArray", function( assert ) {

assert.equal( ( function() { return jQuery.makeArray( arguments ); } )( 1, 2 ).join( "" ), "12", "Pass makeArray an arguments array" );

assert.equal( jQuery.makeArray( [ 1,2,3 ] ).join( "" ), "123", "Pass makeArray a real array" );
assert.equal( jQuery.makeArray( [ 1, 2, 3 ] ).join( "" ), "123", "Pass makeArray a real array" );

assert.equal( jQuery.makeArray().length, 0, "Pass nothing to makeArray and expect an empty array" );

@@ -119,7 +119,6 @@ QUnit.test( "css(String|Hash)", function( assert ) {
"Make sure that a string z-index is returned from css('z-index') (#14432)." );
} );


QUnit.test( "css() explicit and relative values", function( assert ) {
assert.expect( 29 );

@@ -516,14 +515,14 @@ QUnit.test( "show(); hide()", function( assert ) {

hiddendiv = jQuery( "div.hidden" );
hiddendiv.hide();
equal( hiddendiv.css("display"), "none", "Non-detached div hidden" );
equal( hiddendiv.css( "display" ), "none", "Non-detached div hidden" );
hiddendiv.show();
equal( hiddendiv.css("display"), "block", "Pre-hidden div shown" );
equal( hiddendiv.css( "display" ), "block", "Pre-hidden div shown" );

div = jQuery("<div>").hide();
equal( div.css("display"), "none", "Detached div hidden" );
div.appendTo("#qunit-fixture").show();
equal( div.css("display"), "block", "Pre-hidden div shown" );
div = jQuery( "<div>" ).hide();
equal( div.css( "display" ), "none", "Detached div hidden" );
div.appendTo( "#qunit-fixture" ).show();
equal( div.css( "display" ), "block", "Pre-hidden div shown" );

} );

@@ -532,7 +531,7 @@ QUnit.test( "show();", function( assert ) {
assert.expect( 18 );

var hiddendiv, div, pass, test;
hiddendiv = jQuery("div.hidden");
hiddendiv = jQuery( "div.hidden" );

assert.equal( jQuery.css( hiddendiv[ 0 ], "display" ), "none", "hiddendiv is display: none" );

@@ -554,7 +553,7 @@ QUnit.test( "show();", function( assert ) {
assert.ok( pass, "Show" );

// #show-tests * is set display: none in CSS
jQuery("#qunit-fixture").append("<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div>");
jQuery( "#qunit-fixture" ).append( "<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div>" );

test = {
"div": "block",
@@ -583,109 +582,109 @@ QUnit.test( "show();", function( assert ) {
jQuery( "<div>test</div> text <span>test</span>" ).hide().remove();
} );

test("show() resolves correct default display #8099", function() {
expect(7);
var tt8099 = jQuery("<tt/>").appendTo("body"),
dfn8099 = jQuery("<dfn/>", { "html": "foo"}).appendTo("body");
test( "show() resolves correct default display #8099", function() {
expect( 7 );
var tt8099 = jQuery( "<tt/>" ).appendTo( "body" ),
dfn8099 = jQuery( "<dfn/>", { "html": "foo" } ).appendTo( "body" );

equal( tt8099.css("display"), "none", "default display override for all tt" );
equal( tt8099.show().css("display"), "inline", "Correctly resolves display:inline" );
equal( tt8099.css( "display" ), "none", "default display override for all tt" );
equal( tt8099.show().css( "display" ), "inline", "Correctly resolves display:inline" );

equal( jQuery("#foo").hide().show().css("display"), "block", "Correctly resolves display:block after hide/show" );
equal( jQuery( "#foo" ).hide().show().css( "display" ), "block", "Correctly resolves display:block after hide/show" );

equal( tt8099.hide().css("display"), "none", "default display override for all tt" );
equal( tt8099.show().css("display"), "inline", "Correctly resolves display:inline" );
equal( tt8099.hide().css( "display" ), "none", "default display override for all tt" );
equal( tt8099.show().css( "display" ), "inline", "Correctly resolves display:inline" );

equal( dfn8099.css("display"), "none", "default display override for all dfn" );
equal( dfn8099.show().css("display"), "inline", "Correctly resolves display:inline" );
equal( dfn8099.css( "display" ), "none", "default display override for all dfn" );
equal( dfn8099.show().css( "display" ), "inline", "Correctly resolves display:inline" );

tt8099.remove();
dfn8099.remove();
});
} );

QUnit.test( "show() resolves correct default display for detached nodes", function( assert ) {
assert.expect( 13 );

var div, span, tr, trDisplay;

div = jQuery("<div class='hidden'>");
div.show().appendTo("#qunit-fixture");
equal( div.css("display"), "block", "Make sure a detached, pre-hidden( through stylesheets ) div is visible." );
div = jQuery( "<div class='hidden'>" );
div.show().appendTo( "#qunit-fixture" );
equal( div.css( "display" ), "block", "Make sure a detached, pre-hidden( through stylesheets ) div is visible." );

div = jQuery("<div style='display: none'>");
div.show().appendTo("#qunit-fixture");
equal( div.css("display"), "block", "Make sure a detached, pre-hidden( through inline style ) div is visible." );
div = jQuery( "<div style='display: none'>" );
div.show().appendTo( "#qunit-fixture" );
equal( div.css( "display" ), "block", "Make sure a detached, pre-hidden( through inline style ) div is visible." );

span = jQuery("<span class='hidden'/>");
span.show().appendTo("#qunit-fixture");
equal( span.css("display"), "inline", "Make sure a detached, pre-hidden( through stylesheets ) span has default display." );
span = jQuery( "<span class='hidden'/>" );
span.show().appendTo( "#qunit-fixture" );
equal( span.css( "display" ), "inline", "Make sure a detached, pre-hidden( through stylesheets ) span has default display." );

span = jQuery("<span style='display: inline'/>");
span.show().appendTo("#qunit-fixture");
equal( span.css("display"), "inline", "Make sure a detached, pre-hidden( through inline style ) span has default display." );
span = jQuery( "<span style='display: inline'/>" );
span.show().appendTo( "#qunit-fixture" );
equal( span.css( "display" ), "inline", "Make sure a detached, pre-hidden( through inline style ) span has default display." );

div = jQuery("<div><div class='hidden'></div></div>").children("div");
div.show().appendTo("#qunit-fixture");
equal( div.css("display"), "block", "Make sure a detached, pre-hidden( through stylesheets ) div inside another visible div is visible." );
div = jQuery( "<div><div class='hidden'></div></div>" ).children( "div" );
div.show().appendTo( "#qunit-fixture" );
equal( div.css( "display" ), "block", "Make sure a detached, pre-hidden( through stylesheets ) div inside another visible div is visible." );

div = jQuery("<div><div style='display: none'></div></div>").children("div");
div.show().appendTo("#qunit-fixture");
equal( div.css("display"), "block", "Make sure a detached, pre-hidden( through inline style ) div inside another visible div is visible." );
div = jQuery( "<div><div style='display: none'></div></div>" ).children( "div" );
div.show().appendTo( "#qunit-fixture" );
equal( div.css( "display" ), "block", "Make sure a detached, pre-hidden( through inline style ) div inside another visible div is visible." );

div = jQuery( "div.hidden" );
div.detach().show();

equal( div.css("display"), "block", "Make sure a detached( through detach() ), pre-hidden div is visible." );
equal( div.css( "display" ), "block", "Make sure a detached( through detach() ), pre-hidden div is visible." );
div.remove();

span = jQuery("<span>");
span.appendTo("#qunit-fixture").detach().show().appendTo("#qunit-fixture" );
equal( span.css("display"), "inline", "Make sure a detached( through detach() ), pre-hidden span has default display." );
span = jQuery( "<span>" );
span.appendTo( "#qunit-fixture" ).detach().show().appendTo( "#qunit-fixture" );
equal( span.css( "display" ), "inline", "Make sure a detached( through detach() ), pre-hidden span has default display." );
span.remove();

div = jQuery("<div>");
div.show().appendTo("#qunit-fixture");
div = jQuery( "<div>" );
div.show().appendTo( "#qunit-fixture" );
ok( !!div.get( 0 ).style.display, "Make sure not hidden div has a inline style." );
div.remove();

div = jQuery( document.createElement("div") );
div.show().appendTo("#qunit-fixture");
equal( div.css("display"), "block", "Make sure a pre-created element has default display." );
div = jQuery( document.createElement( "div" ) );
div.show().appendTo( "#qunit-fixture" );
equal( div.css( "display" ), "block", "Make sure a pre-created element has default display." );
div.remove();

div = jQuery("<div style='display: inline'/>");
div.show().appendTo("#qunit-fixture");
equal( div.css("display"), "inline", "Make sure that element has same display when it was created." );
div = jQuery( "<div style='display: inline'/>" );
div.show().appendTo( "#qunit-fixture" );
equal( div.css( "display" ), "inline", "Make sure that element has same display when it was created." );
div.remove();

tr = jQuery("<tr/>");
jQuery("#table").append( tr );
tr = jQuery( "<tr/>" );
jQuery( "#table" ).append( tr );
trDisplay = tr.css( "display" );
tr.detach().hide().show();

equal( tr[ 0 ].style.display, trDisplay, "For detached tr elements, display should always be like for attached trs" );
tr.remove();

span = jQuery("<span/>").hide().show();
span = jQuery( "<span/>" ).hide().show();
equal( span[ 0 ].style.display, "inline", "For detached span elements, display should always be inline" );
span.remove();
} );

test("show() resolves correct default display #10227", 4, function() {
test( "show() resolves correct default display #10227", 4, function() {
var htmlDisplay,
html = jQuery( document.documentElement ),
body = jQuery( "body" );

body.append( "<p class='ddisplay'>a<style>body{display:none}</style></p>" );

equal( body.css("display"), "none", "Initial display for body element: none" );
equal( body.css( "display" ), "none", "Initial display for body element: none" );

body.show();
equal( body.css("display"), "block", "Correct display for body element: block" );
equal( body.css( "display" ), "block", "Correct display for body element: block" );

body.append( "<p class='ddisplay'>a<style>html{display:none}</style></p>" );

equal( html.css("display"), "none", "Initial display for html element: none" );
equal( html.css( "display" ), "none", "Initial display for html element: none" );

html.show();
htmlDisplay = html.css( "display" );
@@ -696,22 +695,22 @@ test("show() resolves correct default display #10227", 4, function() {
jQuery._removeData( body[ 0 ] );
jQuery._removeData( html[ 0 ] );
jQuery( ".ddisplay" ).remove();
});
} );

test("show() resolves correct default display when iframe display:none #12904", function() {
expect(2);
test( "show() resolves correct default display when iframe display:none #12904", function() {
expect( 2 );

var ddisplay = jQuery(
"<p id='ddisplay'>a<style>p{display:none}iframe{display:none !important}</style></p>"
).appendTo("body");
).appendTo( "body" );

equal( ddisplay.css("display"), "none", "Initial display: none" );
equal( ddisplay.css( "display" ), "none", "Initial display: none" );

ddisplay.show();
equal( ddisplay.css("display"), "block", "Correct display: block" );
equal( ddisplay.css( "display" ), "block", "Correct display: block" );

ddisplay.remove();
});
} );

QUnit.test( "toggle()", function( assert ) {
assert.expect( 9 );
@@ -752,7 +751,7 @@ QUnit.test( "hide hidden elements (bug #7141)", function( assert ) {
var div = jQuery( "<div style='display:none'></div>" ).appendTo( "#qunit-fixture" );
assert.equal( div.css( "display" ), "none", "Element is hidden by default" );
div.hide();
ok( !jQuery._data(div, "olddisplay"), "olddisplay is undefined after hiding an already-hidden element" );
ok( !jQuery._data( div, "olddisplay" ), "olddisplay is undefined after hiding an already-hidden element" );
div.show();
assert.equal( div.css( "display" ), "block", "Show a double-hidden element" );

@@ -797,18 +796,18 @@ QUnit.test( "computed margins (trac-3333; gh-2237)", function( assert ) {
assert.equal( $div.css( "marginRight" ), "0px",
"marginRight correctly calculated with a width and display block" );

$div.css({
$div.css( {
position: "absolute",
top: 0,
left: 0,
width: "100px"
});
$child.css({
} );
$child.css( {
width: "50px",
margin: "auto"
});
} );
assert.equal( $child.css( "marginLeft" ), "25px", "auto margins are computed to pixels" );
});
} );

QUnit.test( "box model properties incorrectly returning % instead of px, see #10639 and #12088", function( assert ) {
assert.expect( 2 );
@@ -956,8 +955,8 @@ testIframeWithCallback(
}
);

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

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

@@ -1073,7 +1072,7 @@ QUnit.test( ":visible/:hidden selectors", function( assert ) {

assert.t( "Is Visible", "#qunit-fixture div:visible:lt(2)", [ "foo", "nothiddendiv" ] );
assert.t( "Is Not Hidden", "#qunit-fixture:hidden", [] );
assert.t( "Is Hidden", "#form input:hidden", [ "hidden1","hidden2" ] );
assert.t( "Is Hidden", "#form input:hidden", [ "hidden1", "hidden2" ] );

$a = jQuery( "<a href='#'><h1>Header</h1></a>" ).appendTo( "#qunit-fixture" );
assert.ok( $a.is( ":visible" ), "Anchor tag with flow content is visible (gh-2227)" );
@@ -1109,7 +1108,7 @@ QUnit.test(
name: "backgroundAttachment",
value: [ "fixed" ],
expected: [ "scroll" ]
},{
}, {
name: "backgroundColor",
value: [ "rgb(255, 0, 0)", "rgb(255,0,0)", "#ff0000" ],
expected: [ "transparent" ]
@@ -1199,27 +1198,27 @@ QUnit.test( "show() after hide() should always set display to initial value (#14
} );

asyncTest( "Make sure initialized display value for disconnected nodes is correct (#13310)", 4, function() {
var display = jQuery("#display").css("display"),
div = jQuery("<div/>");
var display = jQuery( "#display" ).css( "display" ),
div = jQuery( "<div/>" );

equal( div.css( "display", "inline" ).hide().show().appendTo("body").css( "display" ), "inline", "Initialized display value has returned" );
equal( div.css( "display", "inline" ).hide().show().appendTo( "body" ).css( "display" ), "inline", "Initialized display value has returned" );
div.remove();

div.css( "display", "none" ).hide();
equal( jQuery._data( div[ 0 ], "olddisplay" ), undefined, "olddisplay is undefined after hiding a detached and hidden element" );
div.remove();

div.css( "display", "inline-block" ).hide().appendTo("body").fadeIn(function() {
div.css( "display", "inline-block" ).hide().appendTo( "body" ).fadeIn( function() {
equal( div.css( "display" ), "inline-block", "Initialized display value has returned" );
div.remove();

start();
});
} );

equal( jQuery._data( jQuery("#display").css( "display", "inline" ).hide()[ 0 ], "olddisplay" ), display,
equal( jQuery._data( jQuery( "#display" ).css( "display", "inline" ).hide()[ 0 ], "olddisplay" ), display,
"display: * !Important value should used as initialized display" );
jQuery._removeData( jQuery("#display")[ 0 ] );
});
jQuery._removeData( jQuery( "#display" )[ 0 ] );
} );

QUnit.test( "show() after hide() should always set display to initial value (#14750)", 1, function( assert ) {
var div = jQuery( "<div />" ),
@@ -378,25 +378,25 @@ QUnit.test( "data-* attributes", function( assert ) {
var prop, i, l, metadata, elem,
obj, obj2, check, num, num2,
parseJSON = jQuery.parseJSON,
div = jQuery("<div>"),
child = jQuery("<div data-myobj='old data' data-ignored=\"DOM\" data-other='test'></div>"),
dummy = jQuery("<div data-myobj='old data' data-ignored=\"DOM\" data-other='test'></div>");
div = jQuery( "<div>" ),
child = jQuery( "<div data-myobj='old data' data-ignored=\"DOM\" data-other='test'></div>" ),
dummy = jQuery( "<div data-myobj='old data' data-ignored=\"DOM\" data-other='test'></div>" );

equal( div.data("attr"), undefined, "Check for non-existing data-attr attribute" );
equal( div.data( "attr" ), undefined, "Check for non-existing data-attr attribute" );

div.attr("data-attr", "exists");
equal( div.data("attr"), "exists", "Check for existing data-attr attribute" );
div.attr( "data-attr", "exists" );
equal( div.data( "attr" ), "exists", "Check for existing data-attr attribute" );

div.attr("data-attr", "exists2");
equal( div.data("attr"), "exists", "Check that updates to data- don't update .data()" );
div.attr( "data-attr", "exists2" );
equal( div.data( "attr" ), "exists", "Check that updates to data- don't update .data()" );

div.data("attr", "internal").attr("data-attr", "external");
equal( div.data("attr"), "internal", "Check for .data('attr') precedence (internal > external data-* attribute)" );
div.data( "attr", "internal" ).attr( "data-attr", "external" );
equal( div.data( "attr" ), "internal", "Check for .data('attr') precedence (internal > external data-* attribute)" );

div.remove();

child.appendTo("#qunit-fixture");
equal( child.data("myobj"), "old data", "Value accessed from data-* attribute");
child.appendTo( "#qunit-fixture" );
equal( child.data( "myobj" ), "old data", "Value accessed from data-* attribute" );

child.data( "myobj", "replaced" );
assert.equal(
@@ -567,7 +567,7 @@ QUnit.test( "data-* attributes", function( assert ) {
jQuery( elem ).data( "number" ), true, "Check number property"
);
assert.deepEqual(
jQuery( elem ).data( "stuff" ), [ 2,8 ], "Check stuff property"
jQuery( elem ).data( "stuff" ), [ 2, 8 ], "Check stuff property"
);
break;
default:
@@ -830,10 +830,9 @@ QUnit.test(
}
);

test( "jQuery.data supports interoperable hyphenated/camelCase get/set of properties with arbitrary non-null|NaN|undefined values", function() {

test("jQuery.data supports interoperable hyphenated/camelCase get/set of properties with arbitrary non-null|NaN|undefined values", function() {

var div = jQuery("<div/>", { id: "hyphened" }).appendTo("#qunit-fixture"),
var div = jQuery( "<div/>", { id: "hyphened" } ).appendTo( "#qunit-fixture" ),
datas = {
"non-empty": "a string",
"empty-string": "",
@@ -843,6 +842,7 @@ test("jQuery.data supports interoperable hyphenated/camelCase get/set of propert
"an-object": {},
"bool-true": true,
"bool-false": false,

// JSHint enforces double quotes,
// but JSON strings need double quotes to parse
// so we need escaped double quotes here
@@ -859,40 +859,42 @@ test("jQuery.data supports interoperable hyphenated/camelCase get/set of propert

deepEqual( div.data( key ), val, "get: " + key );
deepEqual( div.data( jQuery.camelCase( key ) ), val, "get: " + jQuery.camelCase( key ) );
});
});
} );
} );

test( ".removeData supports removal of hyphenated properties via array (#12786)", function() {
expect( 4 );

var div, plain, compare;

div = jQuery("<div>").appendTo("#qunit-fixture");
plain = jQuery({});
div = jQuery( "<div>" ).appendTo( "#qunit-fixture" );
plain = jQuery( {} );

// When data is batch assigned (via plain object), the properties
// are not camel cased as they are with (property, value) calls
compare = {

// From batch assignment .data({ "a-a": 1 })
"a-a": 1,

// From property, value assignment .data( "b-b", 1 )
"bB": 1
};

// Mixed assignment
div.data({ "a-a": 1 }).data( "b-b", 1 );
plain.data({ "a-a": 1 }).data( "b-b", 1 );
div.data( { "a-a": 1 } ).data( "b-b", 1 );
plain.data( { "a-a": 1 } ).data( "b-b", 1 );

deepEqual( div.data(), compare, "Data appears as expected. (div)" );
deepEqual( plain.data(), compare, "Data appears as expected. (plain)" );

div.removeData([ "a-a", "b-b" ]);
plain.removeData([ "a-a", "b-b" ]);
div.removeData( [ "a-a", "b-b" ] );
plain.removeData( [ "a-a", "b-b" ] );

// NOTE: Timo's proposal for "propEqual" (or similar) would be nice here
deepEqual( div.data(), {}, "Data is empty. (div)" );
deepEqual( plain.data(), {}, "Data is empty. (plain)" );
});
} );

// Test originally by Moschel
QUnit.test( "Triggering the removeData should not throw exceptions. (#10080)", function( assert ) {

Large diffs are not rendered by default.

@@ -1,6 +1,5 @@
QUnit.module( "deprecated", { teardown: moduleTeardown } );


QUnit.test( "bind/unbind", function( assert ) {
assert.expect( 4 );

@@ -14,7 +13,7 @@ QUnit.test( "bind/unbind", function( assert ) {
assert.equal( e.type, "click", "correct event type" );
assert.equal( e.data.bindData, 19, "correct trigger data" );
assert.equal( trig, 42, "correct bind data" );
assert.equal( e.target.nodeName.toLowerCase(), "b" , "correct element" );
assert.equal( e.target.nodeName.toLowerCase(), "b", "correct element" );
} )
.trigger( "click", [ 42 ] )
.unbind( "click" )
@@ -32,11 +31,11 @@ QUnit.test( "delegate/undelegate", function( assert ) {
markup
.delegate( "b", "click", function( e ) {
assert.equal( e.type, "click", "correct event type" );
assert.equal( e.target.nodeName.toLowerCase(), "b" , "correct element" );
assert.equal( e.target.nodeName.toLowerCase(), "b", "correct element" );
} )
.find( "b" )
.trigger( "click" )
.end()
.undelegate( "b", "click" )
.remove();
} );
} );
@@ -57,7 +57,7 @@ function testWidth( val, assert ) {

assert.equal( jQuery( window ).width(), document.documentElement.clientWidth, "Window width is equal to width reported by window/document." );

QUnit.expectJqData( this, $div[0], "olddisplay" );
QUnit.expectJqData( this, $div[ 0 ], "olddisplay" );
}

QUnit.test( "width()", function( assert ) {
@@ -110,7 +110,7 @@ function testHeight( val, assert ) {

assert.equal( jQuery( window ).height(), document.documentElement.clientHeight, "Window width is equal to width reported by window/document." );

QUnit.expectJqData( this, $div[0], "olddisplay" );
QUnit.expectJqData( this, $div[ 0 ], "olddisplay" );
}

QUnit.test( "height()", function( assert ) {
@@ -167,7 +167,7 @@ QUnit.test( "innerWidth()", function( assert ) {
div.remove();

QUnit.expectJqData( this, $div[ 0 ], "olddisplay" );
});
} );

QUnit.test( "innerHeight()", function( assert ) {
assert.expect( 6 );
@@ -202,7 +202,7 @@ QUnit.test( "innerHeight()", function( assert ) {

div.remove();
QUnit.expectJqData( this, $div[ 0 ], "olddisplay" );
});
} );

QUnit.test( "outerWidth()", function( assert ) {
assert.expect( 11 );
@@ -241,7 +241,7 @@ QUnit.test( "outerWidth()", function( assert ) {

div.remove();
QUnit.expectJqData( this, $div[ 0 ], "olddisplay" );
});
} );

QUnit.test( "child of a hidden elem (or unconnected node) has accurate inner/outer/Width()/Height() see #9441 #9300", function( assert ) {
assert.expect( 16 );
@@ -262,7 +262,7 @@ QUnit.test( "child of a hidden elem (or unconnected node) has accurate inner/out
equal( $divChild.height(), $divNormal.height(), "child of a hidden element height() is wrong see #9441" );
equal( $divChild.innerHeight(), $divNormal.innerHeight(), "child of a hidden element innerHeight() is wrong see #9441" );
equal( $divChild.outerHeight(), $divNormal.outerHeight(), "child of a hidden element outerHeight() is wrong see #9441" );
equal( $divChild.outerHeight(true), $divNormal.outerHeight( true ), "child of a hidden element outerHeight( true ) is wrong see #9300" );
equal( $divChild.outerHeight( true ), $divNormal.outerHeight( true ), "child of a hidden element outerHeight( true ) is wrong see #9300" );

// tests that child div of an unconnected div works the same as a normal div
assert.equal( $divUnconnected.width(), $divNormal.width(), "unconnected element width() is wrong see #9441" );
@@ -273,7 +273,7 @@ QUnit.test( "child of a hidden elem (or unconnected node) has accurate inner/out
equal( $divUnconnected.height(), $divNormal.height(), "unconnected element height() is wrong see #9441" );
equal( $divUnconnected.innerHeight(), $divNormal.innerHeight(), "unconnected element innerHeight() is wrong see #9441" );
equal( $divUnconnected.outerHeight(), $divNormal.outerHeight(), "unconnected element outerHeight() is wrong see #9441" );
equal( $divUnconnected.outerHeight(true), $divNormal.outerHeight( true ), "unconnected element outerHeight( true ) is wrong see #9300" );
equal( $divUnconnected.outerHeight( true ), $divNormal.outerHeight( true ), "unconnected element outerHeight( true ) is wrong see #9300" );

// teardown html
$divHiddenParent.remove();
@@ -335,7 +335,7 @@ QUnit.test( "box-sizing:border-box child of a hidden elem (or unconnected node)
equal( $divChild.height(), $divNormal.height(), "child of a hidden element height() is wrong see #10413" );
equal( $divChild.innerHeight(), $divNormal.innerHeight(), "child of a hidden element innerHeight() is wrong see #10413" );
equal( $divChild.outerHeight(), $divNormal.outerHeight(), "child of a hidden element outerHeight() is wrong see #10413" );
equal( $divChild.outerHeight(true), $divNormal.outerHeight( true ), "child of a hidden element outerHeight( true ) is wrong see #10413" );
equal( $divChild.outerHeight( true ), $divNormal.outerHeight( true ), "child of a hidden element outerHeight( true ) is wrong see #10413" );

// tests that child div of an unconnected div works the same as a normal div
assert.equal( $divUnconnected.width(), $divNormal.width(), "unconnected element width() is wrong see #10413" );
@@ -346,7 +346,7 @@ QUnit.test( "box-sizing:border-box child of a hidden elem (or unconnected node)
equal( $divUnconnected.height(), $divNormal.height(), "unconnected element height() is wrong see #10413" );
equal( $divUnconnected.innerHeight(), $divNormal.innerHeight(), "unconnected element innerHeight() is wrong see #10413" );
equal( $divUnconnected.outerHeight(), $divNormal.outerHeight(), "unconnected element outerHeight() is wrong see #10413" );
equal( $divUnconnected.outerHeight(true), $divNormal.outerHeight( true ), "unconnected element outerHeight( true ) is wrong see #10413" );
equal( $divUnconnected.outerHeight( true ), $divNormal.outerHeight( true ), "unconnected element outerHeight( true ) is wrong see #10413" );

// teardown html
$divHiddenParent.remove();
@@ -389,7 +389,7 @@ QUnit.test( "outerHeight()", function( assert ) {

div.remove();
QUnit.expectJqData( this, $div[ 0 ], "olddisplay" );
});
} );

QUnit.test( "passing undefined is a setter #5571", function( assert ) {
assert.expect( 4 );

Large diffs are not rendered by default.

@@ -938,9 +938,9 @@ if ( jQuery.fn.click ) {
jQuery( "#simon1" ).click();
assert.equal( clickCounter, 1, "Check that click, triggers onclick event handler on an a tag also" );

elem = jQuery("<img />").load(function(){
ok( true, "Trigger the load event, using the shortcut .load() (#2819)");
}).load();
elem = jQuery( "<img />" ).load( function() {
ok( true, "Trigger the load event, using the shortcut .load() (#2819)" );
} ).load();

// manually clean up detached elements
elem.remove();
@@ -1230,7 +1230,7 @@ QUnit.test( "trigger(eventObject, [data], [fn])", function( assert ) {
//$child.on("foo", error );

event = new jQuery.Event( "foo" );
$child.trigger( event, [ 1,2,3 ] ).off();
$child.trigger( event, [ 1, 2, 3 ] ).off();
assert.equal( event.result, "result", "Check event.result attribute" );

// Will error if it bubbles
@@ -2727,6 +2727,7 @@ QUnit.test( "Inline event result is returned (#13993)", function( assert ) {
} );

QUnit.test( ".off() removes the expando when there's no more data", function( assert ) {

// Support: IE 8 only
// IE 8 gets the expando removed via removeAttribute so the second assertion
// won't be reached.
@@ -2348,25 +2348,24 @@ QUnit.test( "Ensure oldIE creates a new set on appendTo (#8894)", function( asse
assert.strictEqual( jQuery( "<p/>" ).appendTo( "<div/>" ).end().length, jQuery( "<p>test</p>" ).appendTo( "<div/>" ).end().length, "Elements created with createElement and with createDocumentFragment should be treated alike" );
} );


test( "html() - script exceptions bubble (#11743)", function() {

expect( 2 );

throws(function() {
jQuery("#qunit-fixture").html("<script>undefined(); ok( false, 'Exception not thrown' );</script>");
throws( function() {
jQuery( "#qunit-fixture" ).html( "<script>undefined(); ok( false, 'Exception not thrown' );</script>" );
ok( false, "Exception ignored" );
}, "Exception bubbled from inline script" );

if ( jQuery.ajax ) {
throws(function() {
jQuery("#qunit-fixture").html("<script src='data/badcall.js'></script>");
throws( function() {
jQuery( "#qunit-fixture" ).html( "<script src='data/badcall.js'></script>" );
ok( false, "Exception ignored" );
}, "Exception thrown in remote script" );
} else {
ok( true, "No jQuery.ajax" );
}
});
} );

QUnit.test( "checked state is cloned with clone()", function( assert ) {

@@ -43,20 +43,20 @@ QUnit.module( "offset", { setup: function() {
the iframe window and the "jQuery" symbol is used to access any static methods.
*/

test("empty set", function() {
expect(2);
test( "empty set", function() {
expect( 2 );
strictEqual( jQuery().offset(), undefined, "offset() returns undefined for empty set (#11962)" );
strictEqual( jQuery().position(), undefined, "position() returns undefined for empty set (#11962)" );
});
} );

test("object without getBoundingClientRect", function() {
expect(2);
test( "object without getBoundingClientRect", function() {
expect( 2 );

// Simulates a browser without gBCR on elements, we just want to return 0,0
var result = jQuery({ ownerDocument: document }).offset();
var result = jQuery( { ownerDocument: document } ).offset();
equal( result.top, 0, "Check top" );
equal( result.left, 0, "Check left" );
});
} );

QUnit.test( "disconnected element", function( assert ) {
assert.expect( 2 );
@@ -497,10 +497,10 @@ testIframe( "offset/body", "body", function( $, window, document, assert ) {
QUnit.test( "chaining", function( assert ) {
assert.expect( 3 );
var coords = { "top": 1, "left": 1 };
equal( jQuery("#absolute-1").offset(coords).selector, "#absolute-1", "offset(coords) returns jQuery object" );
equal( jQuery("#non-existent").offset(coords).selector, "#non-existent", "offset(coords) with empty jQuery set returns jQuery object" );
equal( jQuery("#absolute-1").offset(undefined).selector, "#absolute-1", "offset(undefined) returns jQuery object (#5571)" );
});
equal( jQuery( "#absolute-1" ).offset( coords ).selector, "#absolute-1", "offset(coords) returns jQuery object" );
equal( jQuery( "#non-existent" ).offset( coords ).selector, "#non-existent", "offset(coords) with empty jQuery set returns jQuery object" );
equal( jQuery( "#absolute-1" ).offset( undefined ).selector, "#absolute-1", "offset(undefined) returns jQuery object (#5571)" );
} );

QUnit.test( "offsetParent", function( assert ) {
assert.expect( 13 );
@@ -1,6 +1,6 @@
QUnit.module( "ready" );

(function(){
( function() {
var notYetReady, noEarlyExecution,
order = [],
args = {};
@@ -16,6 +16,7 @@ QUnit.module( "ready" );

// Create an event handler.
function makeHandler( testId ) {

// When returned function is executed, push testId onto `order` array
// to ensure execution order. Also, store event handler arg to ensure
// the correct arg is being passed into the event handler.
@@ -26,48 +27,48 @@ QUnit.module( "ready" );
}

// Bind to the ready event in every possible way.
jQuery(makeHandler("a"));
jQuery(document).ready(makeHandler("b"));
jQuery(document).on("ready.readytest", makeHandler("c"));
jQuery( makeHandler( "a" ) );
jQuery( document ).ready( makeHandler( "b" ) );
jQuery( document ).on( "ready.readytest", makeHandler( "c" ) );

// Do it twice, just to be sure.
jQuery(makeHandler("d"));
jQuery(document).ready(makeHandler("e"));
jQuery(document).on("ready.readytest", makeHandler("f"));
jQuery( makeHandler( "d" ) );
jQuery( document ).ready( makeHandler( "e" ) );
jQuery( document ).on( "ready.readytest", makeHandler( "f" ) );

noEarlyExecution = order.length === 0;

// This assumes that QUnit tests are run on DOM ready!
QUnit.test("jQuery ready", function() {
expect(10);
QUnit.test( "jQuery ready", function() {
expect( 10 );

ok(noEarlyExecution, "Handlers bound to DOM ready should not execute before DOM ready");
ok( noEarlyExecution, "Handlers bound to DOM ready should not execute before DOM ready" );

// Ensure execution order.
deepEqual(order, ["a", "b", "d", "e", "c", "f"], "Bound DOM ready handlers should execute in on-order, but those bound with jQuery(document).on( 'ready', fn ) will always execute last");
deepEqual( order, [ "a", "b", "d", "e", "c", "f" ], "Bound DOM ready handlers should execute in on-order, but those bound with jQuery(document).on( 'ready', fn ) will always execute last" );

// Ensure handler argument is correct.
equal(args["a"], jQuery, "Argument passed to fn in jQuery( fn ) should be jQuery");
equal(args["b"], jQuery, "Argument passed to fn in jQuery(document).ready( fn ) should be jQuery");
ok(args["c"] instanceof jQuery.Event, "Argument passed to fn in jQuery(document).on( 'ready', fn ) should be an event object");
equal( args[ "a" ], jQuery, "Argument passed to fn in jQuery( fn ) should be jQuery" );
equal( args[ "b" ], jQuery, "Argument passed to fn in jQuery(document).ready( fn ) should be jQuery" );
ok( args[ "c" ] instanceof jQuery.Event, "Argument passed to fn in jQuery(document).on( 'ready', fn ) should be an event object" );

order = [];

// Now that the ready event has fired, again bind to the ready event
// in every possible way. These event handlers should execute immediately.
jQuery(makeHandler("g"));
equal(order.pop(), "g", "Event handler should execute immediately");
equal(args["g"], jQuery, "Argument passed to fn in jQuery( fn ) should be jQuery");
jQuery( makeHandler( "g" ) );
equal( order.pop(), "g", "Event handler should execute immediately" );
equal( args[ "g" ], jQuery, "Argument passed to fn in jQuery( fn ) should be jQuery" );

jQuery(document).ready(makeHandler("h"));
equal(order.pop(), "h", "Event handler should execute immediately");
equal(args["h"], jQuery, "Argument passed to fn in jQuery(document).ready( fn ) should be jQuery");
jQuery( document ).ready( makeHandler( "h" ) );
equal( order.pop(), "h", "Event handler should execute immediately" );
equal( args[ "h" ], jQuery, "Argument passed to fn in jQuery(document).ready( fn ) should be jQuery" );

jQuery(document).on("ready.readytest", makeHandler("never"));
equal(order.length, 0, "Event handler should never execute since DOM ready has already passed");
jQuery( document ).on( "ready.readytest", makeHandler( "never" ) );
equal( order.length, 0, "Event handler should never execute since DOM ready has already passed" );

// Cleanup.
jQuery(document).off("ready.readytest");
});
jQuery( document ).off( "ready.readytest" );
} );

} )();
@@ -32,7 +32,7 @@ QUnit.test( "id", function( assert ) {
assert.t( "ID selector with existing ID descendant", "#firstp #simon1", [ "simon1" ] );
assert.t( "ID selector with non-existant descendant", "#firstp #foobar", [] );
assert.t( "ID selector using UTF8", "#台北Táiběi", [ "台北Táiběi" ] );
assert.t( "Multiple ID selectors using UTF8", "#台北Táiběi, #台北", [ "台北Táiběi","台北" ] );
assert.t( "Multiple ID selectors using UTF8", "#台北Táiběi, #台北", [ "台北Táiběi", "台北" ] );
assert.t( "Descendant ID selector using UTF8", "div #台北", [ "台北" ] );
assert.t( "Child ID selector using UTF8", "form > #台北", [ "台北" ] );

@@ -105,14 +105,14 @@ QUnit.test( "child and adjacent", function( assert ) {

var nothiddendiv;

assert.t( "Child", "p > a", [ "simon1","google","groups","mark","yahoo","simon" ] );
assert.t( "Child", "p> a", [ "simon1","google","groups","mark","yahoo","simon" ] );
assert.t( "Child", "p >a", [ "simon1","google","groups","mark","yahoo","simon" ] );
assert.t( "Child", "p>a", [ "simon1","google","groups","mark","yahoo","simon" ] );
assert.t( "Child w/ Class", "p > a.blog", [ "mark","simon" ] );
assert.t( "All Children", "code > *", [ "anchor1","anchor2" ] );
assert.t( "All Grandchildren", "p > * > *", [ "anchor1","anchor2" ] );
assert.t( "Adjacent", "p + p", [ "ap","en","sap" ] );
assert.t( "Child", "p > a", [ "simon1", "google", "groups", "mark", "yahoo", "simon" ] );
assert.t( "Child", "p> a", [ "simon1", "google", "groups", "mark", "yahoo", "simon" ] );
assert.t( "Child", "p >a", [ "simon1", "google", "groups", "mark", "yahoo", "simon" ] );
assert.t( "Child", "p>a", [ "simon1", "google", "groups", "mark", "yahoo", "simon" ] );
assert.t( "Child w/ Class", "p > a.blog", [ "mark", "simon" ] );
assert.t( "All Children", "code > *", [ "anchor1", "anchor2" ] );
assert.t( "All Grandchildren", "p > * > *", [ "anchor1", "anchor2" ] );
assert.t( "Adjacent", "p + p", [ "ap", "en", "sap" ] );
assert.t( "Adjacent", "p#firstp + p", [ "ap" ] );
assert.t( "Adjacent", "p[lang=en] + p", [ "sap" ] );
assert.t( "Adjacent", "a.GROUPS + code + a", [ "mark" ] );
@@ -162,7 +162,7 @@ QUnit.test( "attributes", function( assert ) {
assert.t( "Attribute Equals", "#qunit-fixture a[rel=bookmark]", [ "simon1" ] );
assert.t( "Attribute Equals", "#qunit-fixture a[href='http://www.google.com/']", [ "google" ] );
assert.t( "Attribute Equals", "#qunit-fixture a[ rel = 'bookmark' ]", [ "simon1" ] );
assert.t( "Attribute Equals Number", "#qunit-fixture option[value=1]", [ "option1b","option2b","option3b","option4b","option5c" ] );
assert.t( "Attribute Equals Number", "#qunit-fixture option[value=1]", [ "option1b", "option2b", "option3b", "option4b", "option5c" ] );
assert.t( "Attribute Equals Number", "#qunit-fixture li[tabIndex=-1]", [ "foodWithNegativeTabIndex" ] );

document.getElementById( "anchor2" ).href = "#2";
@@ -186,13 +186,13 @@ QUnit.test( "attributes", function( assert ) {

assert.t( "Attribute selector using UTF8", "span[lang=中文]", [ "台北" ] );

assert.t( "Attribute Begins With", "a[href ^= 'http://www']", [ "google","yahoo" ] );
assert.t( "Attribute Begins With", "a[href ^= 'http://www']", [ "google", "yahoo" ] );
assert.t( "Attribute Ends With", "a[href $= 'org/']", [ "mark" ] );
assert.t( "Attribute Contains", "a[href *= 'google']", [ "google","groups" ] );
assert.t( "Attribute Is Not Equal", "#ap a[hreflang!='en']", [ "google","groups","anchor1" ] );
assert.t( "Attribute Contains", "a[href *= 'google']", [ "google", "groups" ] );
assert.t( "Attribute Is Not Equal", "#ap a[hreflang!='en']", [ "google", "groups", "anchor1" ] );

assert.t( "Empty values", "#select1 option[value='']", [ "option1a" ] );
assert.t( "Empty values", "#select1 option[value!='']", [ "option1b","option1c","option1d" ] );
assert.t( "Empty values", "#select1 option[value!='']", [ "option1b", "option1c", "option1d" ] );

assert.t( "Select options via :selected", "#select1 option:selected", [ "option1a" ] );
assert.t( "Select options via :selected", "#select2 option:selected", [ "option2d" ] );
@@ -10,7 +10,7 @@ QUnit.test( "jQuery.param()", function( assert ) {
params = { "foo":"bar", "baz":42, "quux":"All your base are belong to us" };
assert.equal( jQuery.param( params ), "foo=bar&baz=42&quux=All+your+base+are+belong+to+us", "simple" );

params = { "string":"foo","null":null,"undefined":undefined };
params = { "string":"foo", "null":null, "undefined":undefined };
assert.equal( jQuery.param( params ), "string=foo&null=&undefined=", "handle nulls and undefineds properly" );

params = { "someName": [ 1, 2, 3 ], "regularThing": "blah" };
@@ -25,16 +25,16 @@ QUnit.test( "jQuery.param()", function( assert ) {
params = { "foo": { "bar": "baz", "beep": 42, "quux": "All your base are belong to us" } };
assert.equal( jQuery.param( params ), "foo%5Bbar%5D=baz&foo%5Bbeep%5D=42&foo%5Bquux%5D=All+your+base+are+belong+to+us", "even more arrays" );

params = { a:[ 1,2 ], b:{ c:3, d:[ 4,5 ], e:{ x:[ 6 ], y:7, z:[ 8,9 ] }, f:true, g:false, h:undefined }, i:[ 10,11 ], j:true, k:false, l:[ undefined,0 ], m:"cowboy hat?" };
params = { a:[ 1, 2 ], b:{ c:3, d:[ 4, 5 ], e:{ x:[ 6 ], y:7, z:[ 8, 9 ] }, f:true, g:false, h:undefined }, i:[ 10, 11 ], j:true, k:false, l:[ undefined, 0 ], m:"cowboy hat?" };
assert.equal( decodeURIComponent( jQuery.param( params ) ), "a[]=1&a[]=2&b[c]=3&b[d][]=4&b[d][]=5&b[e][x][]=6&b[e][y]=7&b[e][z][]=8&b[e][z][]=9&b[f]=true&b[g]=false&b[h]=&i[]=10&i[]=11&j=true&k=false&l[]=&l[]=0&m=cowboy+hat?", "huge structure" );

params = { "a": [ 0, [ 1, 2 ], [ 3, [ 4, 5 ], [ 6 ] ], { "b": [ 7, [ 8, 9 ], [ { "c": 10, "d": 11 } ], [ [ 12 ] ], [ [ [ 13 ] ] ], { "e": { "f": { "g": [ 14, [ 15 ] ] } } }, 16 ] }, 17 ] };
assert.equal( decodeURIComponent( jQuery.param( params ) ), "a[]=0&a[1][]=1&a[1][]=2&a[2][]=3&a[2][1][]=4&a[2][1][]=5&a[2][2][]=6&a[3][b][]=7&a[3][b][1][]=8&a[3][b][1][]=9&a[3][b][2][0][c]=10&a[3][b][2][0][d]=11&a[3][b][3][0][]=12&a[3][b][4][0][0][]=13&a[3][b][5][e][f][g][]=14&a[3][b][5][e][f][g][1][]=15&a[3][b][]=16&a[]=17", "nested arrays" );

params = { "a":[ 1,2 ], "b":{ "c":3, "d":[ 4,5 ], "e":{ "x":[ 6 ], "y":7, "z":[ 8,9 ] }, "f":true, "g":false, "h":undefined }, "i":[ 10,11 ], "j":true, "k":false, "l":[ undefined,0 ], "m":"cowboy hat?" };
params = { "a":[ 1, 2 ], "b":{ "c":3, "d":[ 4, 5 ], "e":{ "x":[ 6 ], "y":7, "z":[ 8, 9 ] }, "f":true, "g":false, "h":undefined }, "i":[ 10, 11 ], "j":true, "k":false, "l":[ undefined, 0 ], "m":"cowboy hat?" };
assert.equal( jQuery.param( params, true ), "a=1&a=2&b=%5Bobject+Object%5D&i=10&i=11&j=true&k=false&l=&l=0&m=cowboy+hat%3F", "huge structure, forced traditional" );

assert.equal( decodeURIComponent( jQuery.param( { "a": [ 1,2,3 ], "b[]": [ 4,5,6 ], "c[d]": [ 7,8,9 ], "e": { "f": [ 10 ], "g": [ 11,12 ], "h": 13 } } ) ), "a[]=1&a[]=2&a[]=3&b[]=4&b[]=5&b[]=6&c[d][]=7&c[d][]=8&c[d][]=9&e[f][]=10&e[g][]=11&e[g][]=12&e[h]=13", "Make sure params are not double-encoded." );
assert.equal( decodeURIComponent( jQuery.param( { "a": [ 1, 2, 3 ], "b[]": [ 4, 5, 6 ], "c[d]": [ 7, 8, 9 ], "e": { "f": [ 10 ], "g": [ 11, 12 ], "h": 13 } } ) ), "a[]=1&a[]=2&a[]=3&b[]=4&b[]=5&b[]=6&c[d][]=7&c[d][]=8&c[d][]=9&e[f][]=10&e[g][]=11&e[g][]=12&e[h]=13", "Make sure params are not double-encoded." );

// #7945
assert.equal( jQuery.param( { "jquery": "1.4.2" } ), "jquery=1.4.2", "Check that object with a jQuery property get serialized correctly" );
@@ -62,13 +62,13 @@ QUnit.test( "jQuery.param()", function( assert ) {
params = { "foo[bar]":"baz", "foo[beep]":42, "foo[quux]":"All your base are belong to us" };
assert.equal( jQuery.param( params ), "foo%5Bbar%5D=baz&foo%5Bbeep%5D=42&foo%5Bquux%5D=All+your+base+are+belong+to+us", "even more arrays" );

params = { a:[ 1,2 ], b:{ c:3, d:[ 4,5 ], e:{ x:[ 6 ], y:7, z:[ 8,9 ] }, f:true, g:false, h:undefined }, i:[ 10,11 ], j:true, k:false, l:[ undefined,0 ], m:"cowboy hat?" };
params = { a:[ 1, 2 ], b:{ c:3, d:[ 4, 5 ], e:{ x:[ 6 ], y:7, z:[ 8, 9 ] }, f:true, g:false, h:undefined }, i:[ 10, 11 ], j:true, k:false, l:[ undefined, 0 ], m:"cowboy hat?" };
assert.equal( jQuery.param( params ), "a=1&a=2&b=%5Bobject+Object%5D&i=10&i=11&j=true&k=false&l=&l=0&m=cowboy+hat%3F", "huge structure" );

params = { "a": [ 0, [ 1, 2 ], [ 3, [ 4, 5 ], [ 6 ] ], { "b": [ 7, [ 8, 9 ], [ { "c": 10, d: 11 } ], [ [ 12 ] ], [ [ [ 13 ] ] ], { "e": { "f": { "g": [ 14, [ 15 ] ] } } }, 16 ] }, 17 ] };
assert.equal( jQuery.param( params ), "a=0&a=1%2C2&a=3%2C4%2C5%2C6&a=%5Bobject+Object%5D&a=17", "nested arrays (not possible when jQuery.param.traditional == true)" );

params = { a:[ 1,2 ], b:{ c:3, d:[ 4,5 ], e:{ x:[ 6 ], y:7, z:[ 8,9 ] }, f:true, g:false, h:undefined }, i:[ 10,11 ], j:true, k:false, l:[ undefined,0 ], m:"cowboy hat?" };
params = { a:[ 1, 2 ], b:{ c:3, d:[ 4, 5 ], e:{ x:[ 6 ], y:7, z:[ 8, 9 ] }, f:true, g:false, h:undefined }, i:[ 10, 11 ], j:true, k:false, l:[ undefined, 0 ], m:"cowboy hat?" };
assert.equal( decodeURIComponent( jQuery.param( params, false ) ), "a[]=1&a[]=2&b[c]=3&b[d][]=4&b[d][]=5&b[e][x][]=6&b[e][y]=7&b[e][z][]=8&b[e][z][]=9&b[f]=true&b[g]=false&b[h]=&i[]=10&i[]=11&j=true&k=false&l[]=&l[]=0&m=cowboy+hat?", "huge structure, forced not traditional" );

params = { "param1": null };
@@ -535,6 +535,6 @@ testIframeWithCallback(
assert.ok( true, "no ajax; skipping jQuery.support['" + i + "']" );
}
}
});
} );

} )();