equals(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.");
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
equals(jQuery.param({"jquery":"1.4.2"}),"jquery=1.4.2","Check that object with a jQuery property get serialized correctly");
equal(jQuery.param({"jquery":"1.4.2"}),"jquery=1.4.2","Check that object with a jQuery property get serialized correctly");
jQuery.ajaxSetup({traditional:true});
varparams={foo:"bar",baz:42,quux:"All your base are belong to us"};
equals(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)");
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)");
equals(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]=undefined&i[]=10&i[]=11&j=true&k=false&l[]=undefined&l[]=0&m=cowboy+hat?","huge structure, forced not traditional");
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]=undefined&i[]=10&i[]=11&j=true&k=false&l[]=undefined&l[]=0&m=cowboy+hat?","huge structure, forced not traditional");
params={param1:null};
equals(jQuery.param(params,false),"param1=null","Make sure that null params aren't traversed.");
equal(jQuery.param(params,false),"param1=null","Make sure that null params aren't traversed.");
params={"test":{"length":3,"foo":"bar"}};
equals(jQuery.param(params,false),"test%5Blength%5D=3&test%5Bfoo%5D=bar","Sub-object with a length property");
equal(jQuery.param(params,false),"test%5Blength%5D=3&test%5Bfoo%5D=bar","Sub-object with a length property");
equals($button.attr("value"),"foobar","Value retrieval on a button does not return innerHTML");
equals($button.attr("value","baz").html(),"text","Setting the value does not change innerHTML");
equal($button.attr("value"),"foobar","Value retrieval on a button does not return innerHTML");
equal($button.attr("value","baz").html(),"text","Setting the value does not change innerHTML");
// Attributes with a colon on a table element (#1591)
equals(jQuery("#table").attr("test:attrib"),undefined,"Retrieving a non-existent attribute on a table with a colon does not throw an error.");
equals(jQuery("#table").attr("test:attrib","foobar").attr("test:attrib"),"foobar","Setting an attribute on a table with a colon does not throw an error.");
equal(jQuery("#table").attr("test:attrib"),undefined,"Retrieving a non-existent attribute on a table with a colon does not throw an error.");
equal(jQuery("#table").attr("test:attrib","foobar").attr("test:attrib"),"foobar","Setting an attribute on a table with a colon does not throw an error.");
equals(jQuery(this).css("display"),jQuery.support.inlineBlockNeedsLayout?"inline":"inline-block","inline-block was set on non-floated inline element when animating width/height");
equals(this.offsetWidth,42,"width was animated");
equals(this.offsetHeight,42,"height was animated");
equal(jQuery(this).css("display"),jQuery.support.inlineBlockNeedsLayout?"inline":"inline-block","inline-block was set on non-floated inline element when animating width/height");
equal(this.offsetWidth,42,"width was animated");
equal(this.offsetHeight,42,"height was animated");
ok(noEarlyExecution,"Handlers bound to DOM ready should not execute before DOM ready");
// Ensure execution order.
same(order,["a","b","d","e","c","f"],"Bound DOM ready handlers should execute in bind-order, but those bound with jQuery(document).bind( 'ready', fn ) will always execute last");
deepEqual(order,["a","b","d","e","c","f"],"Bound DOM ready handlers should execute in bind-order, but those bound with jQuery(document).bind( 'ready', fn ) will always execute last");
// Ensure handler argument is correct.
equals(args.a,jQuery,"Argument passed to fn in jQuery( fn ) should be jQuery");
equals(args.b,jQuery,"Argument passed to fn in jQuery(document).ready( fn ) should be jQuery");
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.cinstanceofjQuery.Event,"Argument passed to fn in jQuery(document).bind( 'ready', fn ) should be an event object");
equals(result.text(),defaultText+"buga","Check if text appending works");
equals(jQuery("#select3").append(valueObj("<option value='appendTest'>Append Test</option>")).find("option:last-child").attr("value"),"appendTest","Appending html options to select element");
equal(result.text(),defaultText+"buga","Check if text appending works");
equal(jQuery("#select3").append(valueObj("<option value='appendTest'>Append Test</option>")).find("option:last-child").attr("value"),"appendTest","Appending html options to select element");
QUnit.reset();
varexpected="This link has class=\"blog\": Simon Willison's WeblogTry them out:";
equals(jQuery("#first").text(),defaultText+"buga","Check if text appending works");
equals(jQuery("<option value='appendTest'>Append Test</option>").appendTo("#select3").parent().find("option:last-child").attr("value"),"appendTest","Appending html options to select element");
equal(jQuery("#first").text(),defaultText+"buga","Check if text appending works");
equal(jQuery("<option value='appendTest'>Append Test</option>").appendTo("#select3").parent().find("option:last-child").attr("value"),"appendTest","Appending html options to select element");
equals(result.text(),"buga"+defaultText,"Check if text prepending works");
equals(jQuery("#select3").prepend(val("<option value='prependTest'>Prepend Test</option>")).find("option:first-child").attr("value"),"prependTest","Prepending html options to select element");
equal(result.text(),"buga"+defaultText,"Check if text prepending works");
equal(jQuery("#select3").prepend(val("<option value='prependTest'>Prepend Test</option>")).find("option:first-child").attr("value"),"prependTest","Prepending html options to select element");
QUnit.reset();
varexpected="Try them out:This link has class=\"blog\": Simon Willison's Weblog";
equals(jQuery("#first").text(),"buga"+defaultText,"Check if text prepending works");
equals(jQuery("<option value='prependTest'>Prepend Test</option>").prependTo("#select3").parent().find("option:first-child").attr("value"),"prependTest","Prepending html options to select element");
equal(jQuery("#first").text(),"buga"+defaultText,"Check if text prepending works");
equal(jQuery("<option value='prependTest'>Prepend Test</option>").prependTo("#select3").parent().find("option:first-child").attr("value"),"prependTest","Prepending html options to select element");
QUnit.reset();
varexpected="Try them out:This link has class=\"blog\": Simon Willison's Weblog";
equals(map[0].childNodes.length,1,"The area was inserted.");
equals(map[0].firstChild.nodeName.toLowerCase(),"area","The area was inserted.");
equal(map[0].childNodes.length,1,"The area was inserted.");
equal(map[0].firstChild.nodeName.toLowerCase(),"area","The area was inserted.");
QUnit.reset();
...
...
@@ -1231,9 +1231,9 @@ var testHtml = function(valueObj) {
varchild=jQuery("#qunit-fixture").find("script");
equals(child.length,2,"Make sure that two non-JavaScript script tags are left.");
equals(child[0].type,"something/else","Verify type of script tag.");
equals(child[1].type,"something/else","Verify type of script tag.");
equal(child.length,2,"Make sure that two non-JavaScript script tags are left.");
equal(child[0].type,"something/else","Verify type of script tag.");
equal(child[1].type,"something/else","Verify type of script tag.");
jQuery("#qunit-fixture").html(valueObj("<script>ok( true, 'Test repeated injection of script.' );</script>"));
jQuery("#qunit-fixture").html(valueObj("<script>ok( true, 'Test repeated injection of script.' );</script>"));
...
...
@@ -1243,7 +1243,7 @@ var testHtml = function(valueObj) {
jQuery("#qunit-fixture").html(valueObj("foo <form><script type='text/javascript'>ok( true, 'jQuery().html().evalScripts() Evals Scripts Twice in Firefox, see #975 (2)' );</script></form>"));
jQuery("#qunit-fixture").html(valueObj("<script>equals(jQuery.scriptorder++, 0, 'Script is executed in order');equals(jQuery('#scriptorder').length, 1,'Execute after html (even though appears before)')<\/script><span id='scriptorder'><script>equals(jQuery.scriptorder++, 1, 'Script (nested) is executed in order');equals(jQuery('#scriptorder').length, 1,'Execute after html')<\/script></span><script>equals(jQuery.scriptorder++, 2, 'Script (unnested) is executed in order');equals(jQuery('#scriptorder').length, 1,'Execute after html')<\/script>"));
jQuery("#qunit-fixture").html(valueObj("<script>equal(jQuery.scriptorder++, 0, 'Script is executed in order');equal(jQuery('#scriptorder').length, 1,'Execute after html (even though appears before)')<\/script><span id='scriptorder'><script>equal(jQuery.scriptorder++, 1, 'Script (nested) is executed in order');equal(jQuery('#scriptorder').length, 1,'Execute after html')<\/script></span><script>equal(jQuery.scriptorder++, 2, 'Script (unnested) is executed in order');equal(jQuery('#scriptorder').length, 1,'Execute after html')<\/script>"));
}
test("html(String)",function(){
...
...
@@ -1271,7 +1271,7 @@ test("html(Function) with incoming value", function() {
same(jQuery("#text1").nextUntil("[class=foo]").get(),jQuery("#text1").nextAll().get(),"Non-element nodes must be skipped, since they have no attributes");
deepEqual(jQuery("#text1").nextUntil("[class=foo]").get(),jQuery("#text1").nextAll().get(),"Non-element nodes must be skipped, since they have no attributes");
// For the time being, we're discontinuing support for jQuery(form.elements) since it's ambiguous in IE
// use jQuery([]).add(form.elements) instead.
//equals( jQuery([]).add(jQuery("#form")[0].elements).length, jQuery(jQuery("#form")[0].elements).length, "Array in constructor must equals array in add()" );
//equal( jQuery([]).add(jQuery("#form")[0].elements).length, jQuery(jQuery("#form")[0].elements).length, "Array in constructor must equals array in add()" );
vardivs=jQuery("<div/>").add("#sndp");
ok(!divs[0].parentNode,"Make sure the first element is still the disconnected node.");
divs=jQuery("<div>test</div>").add("#sndp");
equals(divs[0].parentNode.nodeType,11,"Make sure the first element is still the disconnected node.");
equal(divs[0].parentNode.nodeType,11,"Make sure the first element is still the disconnected node.");
divs=jQuery("#sndp").add("<div/>");
ok(!divs[1].parentNode,"Make sure the first element is still the disconnected node.");