From f42010b6574af9e57b3782eced61a7d955bf06d6 Mon Sep 17 00:00:00 2001 From: louisremi Date: Tue, 12 Apr 2011 10:47:46 +0200 Subject: [PATCH] third batch --- test/unit/dimensions.js | 12 +- test/unit/effects.js | 96 ++++---- test/unit/event.js | 180 +++++++------- test/unit/manipulation.js | 478 +++++++++++++++++++------------------- test/unit/offset.js | 214 ++++++++--------- test/unit/queue.js | 22 +- test/unit/traversing.js | 228 +++++++++--------- 7 files changed, 615 insertions(+), 615 deletions(-) diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js index fa59a9f7..641165f4 100644 --- a/test/unit/dimensions.js +++ b/test/unit/dimensions.js @@ -34,7 +34,7 @@ function testWidth( val ) { equals( blah.width( val(10) ), blah, "Make sure that setting a width on an empty set returns the set." ); equals( blah.width(), null, "Make sure 'null' is returned on an empty set"); - jQuery.removeData($div[0], 'olddisplay', true); + jQuery.removeData($div[0], "olddisplay", true); } test("width()", function() { @@ -83,7 +83,7 @@ function testHeight( val ) { equals( blah.height( val(10) ), blah, "Make sure that setting a height on an empty set returns the set." ); equals( blah.height(), null, "Make sure 'null' is returned on an empty set"); - jQuery.removeData($div[0], 'olddisplay', true); + jQuery.removeData($div[0], "olddisplay", true); } test("height()", function() { @@ -132,7 +132,7 @@ test("innerWidth()", function() { equals( div.innerWidth(), 0, "Make sure that disconnected nodes are handled." ); div.remove(); - jQuery.removeData($div[0], 'olddisplay', true); + jQuery.removeData($div[0], "olddisplay", true); }); test("innerHeight()", function() { @@ -161,7 +161,7 @@ test("innerHeight()", function() { equals( div.innerHeight(), 0, "Make sure that disconnected nodes are handled." ); div.remove(); - jQuery.removeData($div[0], 'olddisplay', true); + jQuery.removeData($div[0], "olddisplay", true); }); test("outerWidth()", function() { @@ -191,7 +191,7 @@ test("outerWidth()", function() { equals( div.outerWidth(), 0, "Make sure that disconnected nodes are handled." ); div.remove(); - jQuery.removeData($div[0], 'olddisplay', true); + jQuery.removeData($div[0], "olddisplay", true); }); test("outerHeight()", function() { @@ -220,5 +220,5 @@ test("outerHeight()", function() { equals( div.outerHeight(), 0, "Make sure that disconnected nodes are handled." ); div.remove(); - jQuery.removeData($div[0], 'olddisplay', true); + jQuery.removeData($div[0], "olddisplay", true); }); diff --git a/test/unit/effects.js b/test/unit/effects.js index 4f678511..0979a4c1 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -62,7 +62,7 @@ test("show()", function() { }); // #show-tests * is set display: none in CSS - jQuery("#main").append('

'); + jQuery("#main").append("

"); var old = jQuery("#test-table").show().css("display") !== "table"; jQuery("#test-table").remove(); @@ -96,7 +96,7 @@ test("show(Number) - other displays", function() { stop(); // #show-tests * is set display: none in CSS - jQuery("#main").append('

'); + jQuery("#main").append("

"); var old = jQuery("#test-table").show().css("display") !== "table", num = 0; @@ -138,11 +138,11 @@ test("Persist correct display value", function() { stop(); // #show-tests * is set display: none in CSS - jQuery("#main").append('
foo
'); + jQuery("#main").append("
foo
"); var $span = jQuery("#show-tests span"), displayNone = $span.css("display"), - display = '', num = 0; + display = "", num = 0; $span.show(); @@ -165,10 +165,10 @@ test("Persist correct display value", function() { test("animate(Hash, Object, Function)", function() { expect(1); stop(); - var hash = {opacity: 'show'}; + var hash = {opacity: "show"}; var hashCopy = jQuery.extend({}, hash); - jQuery('#foo').animate(hash, 0, function() { - equals( hash.opacity, hashCopy.opacity, 'Check if animate changed the hash parameter' ); + jQuery("#foo").animate(hash, 0, function() { + equals( hash.opacity, hashCopy.opacity, "Check if animate changed the hash parameter" ); start(); }); }); @@ -193,7 +193,7 @@ test("animate block as inline width/height", function() { if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) { stop(); - jQuery("#foo").css({ display: "inline", width: '', height: '' }).animate({ width: 42, height: 42 }, 100, function() { + jQuery("#foo").css({ display: "inline", width: "", height: "" }).animate({ width: 42, height: 42 }, 100, function() { 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" ); @@ -218,9 +218,9 @@ test("animate native inline width/height", function() { if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) { stop(); - jQuery("#foo").css({ display: "", width: '', height: '' }) - .append('text') - .children('span') + jQuery("#foo").css({ display: "", width: "", height: "" }) + .append("text") + .children("span") .animate({ width: 42, height: 42 }, 100, function() { equals( jQuery(this).css("display"), "inline-block", "inline-block was set on non-floated inline element when animating width/height" ); equals( this.offsetWidth, 42, "width was animated" ); @@ -317,13 +317,13 @@ test("animate option (queue === false)", function () { var order = []; var $foo = jQuery("#foo"); - $foo.animate({width:'100px'}, 3000, function () { + $foo.animate({width:"100px"}, 3000, function () { // should finish after unqueued animation so second order.push(2); same( order, [ 1, 2 ], "Animations finished in the correct order" ); start(); }); - $foo.animate({fontSize:'2em'}, {queue:false, duration:10, complete:function () { + $foo.animate({fontSize:"2em"}, {queue:false, duration:10, complete:function () { // short duration and out of queue so should finish first order.push(1); }}); @@ -433,7 +433,7 @@ test("stop()", function() { var w = 0; $foo.hide().width(200).width(); - $foo.animate({ width:'show' }, 1000); + $foo.animate({ width: "show" }, 1000); setTimeout(function(){ var nw = $foo.width(); notEqual( nw, w, "An animation occurred " + nw + "px " + w + "px"); @@ -458,9 +458,9 @@ test("stop() - several in queue", function() { var w = 0; $foo.hide().width(200).width(); - $foo.animate({ width:'show' }, 1000); - $foo.animate({ width:'hide' }, 1000); - $foo.animate({ width:'show' }, 1000); + $foo.animate({ width: "show" }, 1000); + $foo.animate({ width: "hide" }, 1000); + $foo.animate({ width: "show" }, 1000); setTimeout(function(){ equals( $foo.queue().length, 3, "All 3 still in the queue" ); var nw = $foo.width(); @@ -483,9 +483,9 @@ test("stop(clearQueue)", function() { var w = 0; $foo.hide().width(200).width(); - $foo.animate({ width:'show' }, 1000); - $foo.animate({ width:'hide' }, 1000); - $foo.animate({ width:'show' }, 1000); + $foo.animate({ width: "show" }, 1000); + $foo.animate({ width: "hide" }, 1000); + $foo.animate({ width: "show" }, 1000); setTimeout(function(){ var nw = $foo.width(); ok( nw != w, "An animation occurred " + nw + "px " + w + "px"); @@ -510,10 +510,10 @@ test("stop(clearQueue, gotoEnd)", function() { var w = 0; $foo.hide().width(200).width(); - $foo.animate({ width:'show' }, 1000); - $foo.animate({ width:'hide' }, 1000); - $foo.animate({ width:'show' }, 1000); - $foo.animate({ width:'hide' }, 1000); + $foo.animate({ width: "show" }, 1000); + $foo.animate({ width: "hide" }, 1000); + $foo.animate({ width: "show" }, 1000); + $foo.animate({ width: "hide" }, 1000); setTimeout(function(){ var nw = $foo.width(); ok( nw != w, "An animation occurred " + nw + "px " + w + "px"); @@ -783,7 +783,7 @@ jQuery.each( { }); jQuery.fn.saveState = function(hiddenOverflow){ - var check = ['opacity','height','width','display','overflow']; + var check = ["opacity", "height", "width", "display", "overflow"]; expect(check.length); stop(); @@ -804,64 +804,64 @@ jQuery.checkState = function(){ }); // manually clean data on modified element - jQuery.removeData(this, 'olddisplay', true); + jQuery.removeData(this, "olddisplay", true); start(); } // Chaining Tests test("Chain fadeOut fadeIn", function() { - jQuery('#fadein div').saveState().fadeOut('fast').fadeIn('fast',jQuery.checkState); + jQuery("#fadein div").saveState().fadeOut("fast").fadeIn("fast",jQuery.checkState); }); test("Chain fadeIn fadeOut", function() { - jQuery('#fadeout div').saveState().fadeIn('fast').fadeOut('fast',jQuery.checkState); + jQuery("#fadeout div").saveState().fadeIn("fast").fadeOut("fast",jQuery.checkState); }); test("Chain hide show", function() { - jQuery('#show div').saveState(jQuery.support.shrinkWrapBlocks).hide('fast').show('fast',jQuery.checkState); + jQuery("#show div").saveState(jQuery.support.shrinkWrapBlocks).hide("fast").show("fast",jQuery.checkState); }); test("Chain show hide", function() { - jQuery('#hide div').saveState(jQuery.support.shrinkWrapBlocks).show('fast').hide('fast',jQuery.checkState); + jQuery("#hide div").saveState(jQuery.support.shrinkWrapBlocks).show("fast").hide("fast",jQuery.checkState); }); test("Chain show hide with easing and callback", function() { - jQuery('#hide div').saveState().show('fast').hide('fast','linear',jQuery.checkState); + jQuery("#hide div").saveState().show("fast").hide("fast","linear",jQuery.checkState); }); test("Chain toggle in", function() { - jQuery('#togglein div').saveState(jQuery.support.shrinkWrapBlocks).toggle('fast').toggle('fast',jQuery.checkState); + jQuery("#togglein div").saveState(jQuery.support.shrinkWrapBlocks).toggle("fast").toggle("fast",jQuery.checkState); }); test("Chain toggle out", function() { - jQuery('#toggleout div').saveState(jQuery.support.shrinkWrapBlocks).toggle('fast').toggle('fast',jQuery.checkState); + jQuery("#toggleout div").saveState(jQuery.support.shrinkWrapBlocks).toggle("fast").toggle("fast",jQuery.checkState); }); test("Chain toggle out with easing and callback", function() { - jQuery('#toggleout div').saveState(jQuery.support.shrinkWrapBlocks).toggle('fast').toggle('fast','linear',jQuery.checkState); + jQuery("#toggleout div").saveState(jQuery.support.shrinkWrapBlocks).toggle("fast").toggle("fast","linear",jQuery.checkState); }); test("Chain slideDown slideUp", function() { - jQuery('#slidedown div').saveState(jQuery.support.shrinkWrapBlocks).slideDown('fast').slideUp('fast',jQuery.checkState); + jQuery("#slidedown div").saveState(jQuery.support.shrinkWrapBlocks).slideDown("fast").slideUp("fast",jQuery.checkState); }); test("Chain slideUp slideDown", function() { - jQuery('#slideup div').saveState(jQuery.support.shrinkWrapBlocks).slideUp('fast').slideDown('fast',jQuery.checkState); + jQuery("#slideup div").saveState(jQuery.support.shrinkWrapBlocks).slideUp("fast").slideDown("fast",jQuery.checkState); }); test("Chain slideUp slideDown with easing and callback", function() { - jQuery('#slideup div').saveState(jQuery.support.shrinkWrapBlocks).slideUp('fast').slideDown('fast','linear',jQuery.checkState); + jQuery("#slideup div").saveState(jQuery.support.shrinkWrapBlocks).slideUp("fast").slideDown("fast","linear",jQuery.checkState); }); test("Chain slideToggle in", function() { - jQuery('#slidetogglein div').saveState(jQuery.support.shrinkWrapBlocks).slideToggle('fast').slideToggle('fast',jQuery.checkState); + jQuery("#slidetogglein div").saveState(jQuery.support.shrinkWrapBlocks).slideToggle("fast").slideToggle("fast",jQuery.checkState); }); test("Chain slideToggle out", function() { - jQuery('#slidetoggleout div').saveState(jQuery.support.shrinkWrapBlocks).slideToggle('fast').slideToggle('fast',jQuery.checkState); + jQuery("#slidetoggleout div").saveState(jQuery.support.shrinkWrapBlocks).slideToggle("fast").slideToggle("fast",jQuery.checkState); }); test("Chain fadeToggle in", function() { - jQuery('#fadetogglein div').saveState().fadeToggle('fast').fadeToggle('fast',jQuery.checkState); + jQuery("#fadetogglein div").saveState().fadeToggle("fast").fadeToggle("fast",jQuery.checkState); }); test("Chain fadeToggle out", function() { - jQuery('#fadetoggleout div').saveState().fadeToggle('fast').fadeToggle('fast',jQuery.checkState); + jQuery("#fadetoggleout div").saveState().fadeToggle("fast").fadeToggle("fast",jQuery.checkState); }); test("Chain fadeTo 0.5 1.0 with easing and callback)", function() { - jQuery('#fadeto div').saveState().fadeTo('fast',0.5).fadeTo('fast',1.0,'linear',jQuery.checkState); + jQuery("#fadeto div").saveState().fadeTo("fast",0.5).fadeTo("fast",1.0,"linear",jQuery.checkState); }); jQuery.makeTest = function( text ){ @@ -903,23 +903,23 @@ test("animate with per-property easing", function(){ var _test2_called = false; var _default_test_called = false; - jQuery.easing['_test1'] = function() { + jQuery.easing["_test1"] = function() { _test1_called = true; }; - jQuery.easing['_test2'] = function() { + jQuery.easing["_test2"] = function() { _test2_called = true; }; - jQuery.easing['_default_test'] = function() { + jQuery.easing["_default_test"] = function() { _default_test_called = true; }; jQuery({a:0,b:0,c:0}).animate({ - a: [100, '_test1'], - b: [100, '_test2'], + a: [100, "_test1"], + b: [100, "_test2"], c: 100 - }, 400, '_default_test', function(){ + }, 400, "_default_test", function(){ start(); ok(_test1_called, "Easing function (1) called"); ok(_test2_called, "Easing function (2) called"); diff --git a/test/unit/event.js b/test/unit/event.js index cefdf583..d3e57614 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -305,7 +305,7 @@ test("bind/delegate bubbling, isDefaultPrevented", function() { fakeClick = function($jq) { // Use a native click so we don't get jQuery simulated bubbling if ( document.createEvent ) { - var e = document.createEvent( 'MouseEvents' ); + var e = document.createEvent( "MouseEvents" ); e.initEvent( "click", true, true ); $jq[0].dispatchEvent(e); } @@ -347,7 +347,7 @@ test("bind(), iframes", function() { jQuery("div", doc).bind("click", function() { ok( true, "Binding to element inside iframe" ); - }).click().unbind('click'); + }).click().unbind("click"); }); test("bind(), trigger change on select", function() { @@ -357,8 +357,8 @@ test("bind(), trigger change on select", function() { equals( event.data, counter++, "Event.data is not a global event object" ); }; jQuery("#form select").each(function(i){ - jQuery(this).bind('change', i, selectOnChange); - }).trigger('change'); + jQuery(this).bind("change", i, selectOnChange); + }).trigger("change"); }); test("bind(), namespaced events, cloned events", 18, function() { @@ -646,23 +646,23 @@ test("unbind(type)", function() { } message = "unbind passing function"; - $elem.bind('error1', error).unbind('error1',error).triggerHandler('error1'); + $elem.bind("error1", error).unbind("error1", error).triggerHandler("error1"); message = "unbind all from event"; - $elem.bind('error1', error).unbind('error1').triggerHandler('error1'); + $elem.bind("error1", error).unbind("error1").triggerHandler("error1"); message = "unbind all"; - $elem.bind('error1', error).unbind().triggerHandler('error1'); + $elem.bind("error1", error).unbind().triggerHandler("error1"); message = "unbind many with function"; - $elem.bind('error1 error2',error) - .unbind('error1 error2', error ) - .trigger('error1').triggerHandler('error2'); + $elem.bind("error1 error2",error) + .unbind("error1 error2", error ) + .trigger("error1").triggerHandler("error2"); message = "unbind many"; // #3538 - $elem.bind('error1 error2',error) - .unbind('error1 error2') - .trigger('error1').triggerHandler('error2'); + $elem.bind("error1 error2", error) + .unbind("error1 error2") + .trigger("error1").triggerHandler("error2"); message = "unbind without a type or handler"; $elem.bind("error1 error2.test",error) @@ -678,28 +678,28 @@ test("unbind(eventObject)", function() { function assert( expected ){ num = 0; - $elem.trigger('foo').triggerHandler('bar'); + $elem.trigger("foo").triggerHandler("bar"); equals( num, expected, "Check the right handlers are triggered" ); } $elem // This handler shouldn't be unbound - .bind('foo', function(){ + .bind("foo", function(){ num += 1; }) - .bind('foo', function(e){ + .bind("foo", function(e){ $elem.unbind( e ) num += 2; }) // Neither this one - .bind('bar', function(){ + .bind("bar", function(){ num += 4; }); assert( 7 ); assert( 5 ); - $elem.unbind('bar'); + $elem.unbind("bar"); assert( 1 ); $elem.unbind(); @@ -732,7 +732,7 @@ test("mouseover triggers mouseenter", function() { elem.mouseenter(function () { count++; }); - elem.trigger('mouseover'); + elem.trigger("mouseover"); equals(count, 1, "make sure mouseover triggers a mouseenter" ); elem.remove(); @@ -741,9 +741,9 @@ test("mouseover triggers mouseenter", function() { test("trigger() shortcuts", function() { expect(6); - var elem = jQuery('
  • Change location
  • ').prependTo('#firstUL'); - elem.find('a').bind('click', function() { - var close = jQuery('spanx', this); // same with jQuery(this).find('span'); + var elem = jQuery("
  • Change location
  • ").prependTo("#firstUL"); + elem.find("a").bind("click", function() { + var close = jQuery("spanx", this); // same with jQuery(this).find("span"); equals( close.length, 0, "Context element does not exist, length must be zero" ); ok( !close[0], "Context element does not exist, direct access to element must return undefined" ); return false; @@ -757,20 +757,20 @@ test("trigger() shortcuts", function() { }).click(); var counter = 0; - jQuery('#firstp')[0].onclick = function(event) { + jQuery("#firstp")[0].onclick = function(event) { counter++; }; - jQuery('#firstp').click(); + jQuery("#firstp").click(); equals( counter, 1, "Check that click, triggers onclick event handler also" ); var clickCounter = 0; - jQuery('#simon1')[0].onclick = function(event) { + jQuery("#simon1")[0].onclick = function(event) { clickCounter++; }; - jQuery('#simon1').click(); + jQuery("#simon1").click(); equals( clickCounter, 1, "Check that click, triggers onclick event handler on an a tag also" ); - elem = jQuery('').load(function(){ + elem = jQuery("").load(function(){ ok( true, "Trigger the load event, using the shortcut .load() (#2819)"); }).load(); @@ -853,7 +853,7 @@ test("trigger(type, [data], [fn])", function() { var pass = true; try { - jQuery('#form input:first').hide().trigger('focus'); + jQuery("#form input:first").hide().trigger("focus"); } catch(e) { pass = false; } @@ -861,7 +861,7 @@ test("trigger(type, [data], [fn])", function() { pass = true; try { - jQuery('#main table:first').bind('test:test', function(){}).trigger('test:test'); + jQuery("#main table:first").bind("test:test", function(){}).trigger("test:test"); } catch (e) { pass = false; } @@ -899,8 +899,8 @@ test("jQuery.Event.currentTarget", function(){ test("trigger(eventObject, [data], [fn])", function() { expect(25); - var $parent = jQuery('
    ').hide().appendTo('body'), - $child = jQuery('

    foo

    ').appendTo( $parent ); + var $parent = jQuery("
    ").hide().appendTo("body"), + $child = jQuery("

    foo

    ").appendTo( $parent ); var event = jQuery.Event("noNew"); ok( event != window, "Instantiate jQuery.Event without the 'new' keyword" ); @@ -920,21 +920,21 @@ test("trigger(eventObject, [data], [fn])", function() { equals( event.isPropagationStopped(), true, "Verify isPropagationStopped" ); equals( event.isImmediatePropagationStopped(), true, "Verify isPropagationStopped" ); - $parent.bind('foo',function(e){ + $parent.bind("foo",function(e){ // Tries bubbling - equals( e.type, 'foo', 'Verify event type when passed passing an event object' ); - equals( e.target.id, 'child', 'Verify event.target when passed passing an event object' ); - equals( e.currentTarget.id, 'par', 'Verify event.target when passed passing an event object' ); - equals( e.secret, 'boo!', 'Verify event object\'s custom attribute when passed passing an event object' ); + equals( e.type, "foo", "Verify event type when passed passing an event object" ); + equals( e.target.id, "child", "Verify event.target when passed passing an event object" ); + equals( e.currentTarget.id, "par", "Verify event.target when passed passing an event object" ); + equals( e.secret, "boo!", "Verify event object's custom attribute when passed passing an event object" ); }); // test with an event object event = new jQuery.Event("foo"); - event.secret = 'boo!'; + event.secret = "boo!"; $child.trigger(event); // test with a literal object - $child.trigger({type:'foo', secret:'boo!'}); + $child.trigger({type: "foo", secret: "boo!"}); $parent.unbind(); @@ -942,9 +942,9 @@ test("trigger(eventObject, [data], [fn])", function() { ok( false, "This assertion shouldn't be reached"); } - $parent.bind('foo', error ); + $parent.bind("foo", error ); - $child.bind('foo',function(e, a, b, c ){ + $child.bind("foo",function(e, a, b, c ){ equals( arguments.length, 4, "Check arguments length"); equals( a, 1, "Check first custom argument"); equals( b, 2, "Check second custom argument"); @@ -962,14 +962,14 @@ test("trigger(eventObject, [data], [fn])", function() { // We should add this back in when we want to test the order // in which event handlers are iterated. - //$child.bind('foo', error ); + //$child.bind("foo", error ); event = new jQuery.Event("foo"); $child.trigger( event, [1,2,3] ).unbind(); equals( event.result, "result", "Check event.result attribute"); // Will error if it bubbles - $child.triggerHandler('foo'); + $child.triggerHandler("foo"); $child.unbind(); $parent.unbind().remove(); @@ -1000,12 +1000,12 @@ test("jQuery.Event.currentTarget", function(){ expect(1); var counter = 0, - $elem = jQuery('').click(function(e){ + $elem = jQuery("").click(function(e){ equals( e.currentTarget, this, "Check currentTarget on "+(counter++?"native":"fake") +" event" ); }); // Fake event - $elem.trigger('click'); + $elem.trigger("click"); // Cleanup $elem.unbind(); @@ -1018,7 +1018,7 @@ test("toggle(Function, Function, ...)", function() { fn1 = function(e) { count++; }, fn2 = function(e) { count--; }, preventDefault = function(e) { e.preventDefault() }, - link = jQuery('#mark'); + link = jQuery("#mark"); link.click(preventDefault).click().toggle(fn1, fn2).click().click().click().click().click(); equals( count, 1, "Check for toggle(fn, fn)" ); @@ -1062,8 +1062,8 @@ test("toggle(Function, Function, ...)", function() { $div.click(); equals( turn, 2, "Trying toggle with 3 functions, attempt 5 yields 2"); - $div.unbind('click',fns[0]); - var data = jQuery._data( $div[0], 'events' ); + $div.unbind("click",fns[0]); + var data = jQuery._data( $div[0], "events" ); ok( !data, "Unbinding one function from toggle unbinds them all"); // manually clean up detached elements @@ -1178,12 +1178,12 @@ test(".live()/.die()", function() { jQuery("div").die("submit"); // Test binding with a different context - var clicked = 0, container = jQuery('#main')[0]; + var clicked = 0, container = jQuery("#main")[0]; jQuery("#foo", container).live("click", function(e){ clicked++; }); - jQuery("div").trigger('click'); - jQuery("#foo").trigger('click'); - jQuery("#main").trigger('click'); - jQuery("body").trigger('click'); + jQuery("div").trigger("click"); + jQuery("#foo").trigger("click"); + jQuery("#main").trigger("click"); + jQuery("body").trigger("click"); equals( clicked, 2, "live with a context" ); // Make sure the event is actually stored on the context @@ -1191,7 +1191,7 @@ test(".live()/.die()", function() { // Test unbinding with a different context jQuery("#foo", container).die("click"); - jQuery("#foo").trigger('click'); + jQuery("#foo").trigger("click"); equals( clicked, 2, "die with a context"); // Test binding with event data @@ -1273,9 +1273,9 @@ test(".live()/.die()", function() { // Make sure we don't loose the target by DOM modifications // after the bubble already reached the liveHandler - var livec = 0, elemDiv = jQuery("#nothiddendivchild").html('').get(0); + var livec = 0, elemDiv = jQuery("#nothiddendivchild").html("").get(0); - jQuery("#nothiddendivchild").live("click", function(e){ jQuery("#nothiddendivchild").html(''); }); + jQuery("#nothiddendivchild").live("click", function(e){ jQuery("#nothiddendivchild").html(""); }); jQuery("#nothiddendivchild").live("click", function(e){ if(e.target) {livec++;} }); jQuery("#nothiddendiv span").click(); @@ -1290,20 +1290,20 @@ test(".live()/.die()", function() { var lived = 0, livee = 0; // bind one pair in one order - jQuery('span#liveSpan1 a').live('click', function(){ lived++; return false; }); - jQuery('span#liveSpan1').live('click', function(){ livee++; }); + jQuery("span#liveSpan1 a").live("click", function(){ lived++; return false; }); + jQuery("span#liveSpan1").live("click", function(){ livee++; }); - jQuery('span#liveSpan1 a').click(); + jQuery("span#liveSpan1 a").click(); equals( lived, 1, "Verify that only one first handler occurred." ); equals( livee, 0, "Verify that second handler doesn't." ); // and one pair in inverse - jQuery('span#liveSpan2').live('click', function(){ livee++; }); - jQuery('span#liveSpan2 a').live('click', function(){ lived++; return false; }); + jQuery("span#liveSpan2").live("click", function(){ livee++; }); + jQuery("span#liveSpan2 a").live("click", function(){ lived++; return false; }); lived = 0; livee = 0; - jQuery('span#liveSpan2 a').click(); + jQuery("span#liveSpan2 a").click(); equals( lived, 1, "Verify that only one first handler occurred." ); equals( livee, 0, "Verify that second handler doesn't." ); @@ -1314,15 +1314,15 @@ test(".live()/.die()", function() { jQuery("span#liveSpan2").die("click"); // Test this, target and currentTarget are correct - jQuery('span#liveSpan1').live('click', function(e){ - equals( this.id, 'liveSpan1', 'Check the this within a live handler' ); - equals( e.currentTarget.id, 'liveSpan1', 'Check the event.currentTarget within a live handler' ); - equals( e.target.nodeName.toUpperCase(), 'A', 'Check the event.target within a live handler' ); + jQuery("span#liveSpan1").live("click", function(e){ + equals( this.id, "liveSpan1", "Check the this within a live handler" ); + equals( e.currentTarget.id, "liveSpan1", "Check the event.currentTarget within a live handler" ); + equals( e.target.nodeName.toUpperCase(), "A", "Check the event.target within a live handler" ); }); - jQuery('span#liveSpan1 a').click(); + jQuery("span#liveSpan1 a").click(); - jQuery('span#liveSpan1').die('click'); + jQuery("span#liveSpan1").die("click"); // Work with deep selectors livee = 0; @@ -1705,12 +1705,12 @@ test(".delegate()/.undelegate()", function() { jQuery("#body").undelegate("div", "submit"); // Test binding with a different context - var clicked = 0, container = jQuery('#main')[0]; + var clicked = 0, container = jQuery("#main")[0]; jQuery("#main").delegate("#foo", "click", function(e){ clicked++; }); - jQuery("div").trigger('click'); - jQuery("#foo").trigger('click'); - jQuery("#main").trigger('click'); - jQuery("body").trigger('click'); + jQuery("div").trigger("click"); + jQuery("#foo").trigger("click"); + jQuery("#main").trigger("click"); + jQuery("body").trigger("click"); equals( clicked, 2, "delegate with a context" ); // Make sure the event is actually stored on the context @@ -1718,7 +1718,7 @@ test(".delegate()/.undelegate()", function() { // Test unbinding with a different context jQuery("#main").undelegate("#foo", "click"); - jQuery("#foo").trigger('click'); + jQuery("#foo").trigger("click"); equals( clicked, 2, "undelegate with a context"); // Test binding with event data @@ -1804,9 +1804,9 @@ test(".delegate()/.undelegate()", function() { // Make sure we don't loose the target by DOM modifications // after the bubble already reached the liveHandler - var livec = 0, elemDiv = jQuery("#nothiddendivchild").html('').get(0); + var livec = 0, elemDiv = jQuery("#nothiddendivchild").html("").get(0); - jQuery("#body").delegate("#nothiddendivchild", "click", function(e){ jQuery("#nothiddendivchild").html(''); }); + jQuery("#body").delegate("#nothiddendivchild", "click", function(e){ jQuery("#nothiddendivchild").html(""); }); jQuery("#body").delegate("#nothiddendivchild", "click", function(e){ if(e.target) {livec++;} }); jQuery("#nothiddendiv span").click(); @@ -1821,20 +1821,20 @@ test(".delegate()/.undelegate()", function() { var lived = 0, livee = 0; // bind one pair in one order - jQuery("#body").delegate('span#liveSpan1 a', 'click', function(){ lived++; return false; }); - jQuery("#body").delegate('span#liveSpan1', 'click', function(){ livee++; }); + jQuery("#body").delegate("span#liveSpan1 a", "click", function(){ lived++; return false; }); + jQuery("#body").delegate("span#liveSpan1", "click", function(){ livee++; }); - jQuery('span#liveSpan1 a').click(); + jQuery("span#liveSpan1 a").click(); equals( lived, 1, "Verify that only one first handler occurred." ); equals( livee, 0, "Verify that second handler doesn't." ); // and one pair in inverse - jQuery("#body").delegate('span#liveSpan2', 'click', function(){ livee++; }); - jQuery("#body").delegate('span#liveSpan2 a', 'click', function(){ lived++; return false; }); + jQuery("#body").delegate("span#liveSpan2", "click", function(){ livee++; }); + jQuery("#body").delegate("span#liveSpan2 a", "click", function(){ lived++; return false; }); lived = 0; livee = 0; - jQuery('span#liveSpan2 a').click(); + jQuery("span#liveSpan2 a").click(); equals( lived, 1, "Verify that only one first handler occurred." ); equals( livee, 0, "Verify that second handler doesn't." ); @@ -1842,15 +1842,15 @@ test(".delegate()/.undelegate()", function() { jQuery("#body").undelegate("click"); // Test this, target and currentTarget are correct - jQuery("#body").delegate('span#liveSpan1', 'click', function(e){ - equals( this.id, 'liveSpan1', 'Check the this within a delegate handler' ); - equals( e.currentTarget.id, 'liveSpan1', 'Check the event.currentTarget within a delegate handler' ); - equals( e.target.nodeName.toUpperCase(), 'A', 'Check the event.target within a delegate handler' ); + jQuery("#body").delegate("span#liveSpan1", "click", function(e){ + equals( this.id, "liveSpan1", "Check the this within a delegate handler" ); + equals( e.currentTarget.id, "liveSpan1", "Check the event.currentTarget within a delegate handler" ); + equals( e.target.nodeName.toUpperCase(), "A", "Check the event.target within a delegate handler" ); }); - jQuery('span#liveSpan1 a').click(); + jQuery("span#liveSpan1 a").click(); - jQuery("#body").undelegate('span#liveSpan1', 'click'); + jQuery("#body").undelegate("span#liveSpan1", "click"); // Work with deep selectors livee = 0; @@ -2027,11 +2027,11 @@ test("Non DOM element events", function() { var o = {}; - jQuery(o).bind('nonelementobj', function(e) { + jQuery(o).bind("nonelementobj", function(e) { ok( true, "Event on non-DOM object triggered" ); }); - jQuery(o).trigger('nonelementobj'); + jQuery(o).trigger("nonelementobj"); }); test("window resize", function() { @@ -2049,7 +2049,7 @@ test("window resize", function() { test("focusin bubbles", function() { expect(5); - var input = jQuery( '' ).prependTo( "body" ), + var input = jQuery( "" ).prependTo( "body" ), order = 0; jQuery( "body" ).bind( "focusin.focusinBubblesTest", function(){ diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index e972a479..64265c9b 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -9,7 +9,7 @@ var functionReturningObj = function(value) { return (function() { return value; test("text()", function() { expect(2); var expected = "This link has class=\"blog\": Simon Willison's Weblog"; - equals( jQuery('#sap').text(), expected, 'Check for merged text of more then one element.' ); + equals( jQuery("#sap").text(), expected, "Check for merged text of more then one element." ); // Check serialization of text values equals( jQuery(document.createTextNode("foo")).text(), "foo", "Text node was retreived from .text()." ); @@ -43,34 +43,34 @@ test("text(Function) with incoming value", function() { var old = "This link has class=\"blog\": Simon Willison's Weblog"; - jQuery('#sap').text(function(i, val) { + jQuery("#sap").text(function(i, val) { equals( val, old, "Make sure the incoming value is correct." ); return "foobar"; }); - equals( jQuery("#sap").text(), "foobar", 'Check for merged text of more then one element.' ); + equals( jQuery("#sap").text(), "foobar", "Check for merged text of more then one element." ); QUnit.reset(); }); var testWrap = function(val) { expect(19); - var defaultText = 'Try them out:' - var result = jQuery('#first').wrap(val( '
    ' )).text(); - equals( defaultText, result, 'Check for wrapping of on-the-fly html' ); - ok( jQuery('#first').parent().parent().is('.red'), 'Check if wrapper has class "red"' ); + var defaultText = "Try them out:" + var result = jQuery("#first").wrap(val( "
    " )).text(); + equals( defaultText, result, "Check for wrapping of on-the-fly html" ); + ok( jQuery("#first").parent().parent().is(".red"), "Check if wrapper has class 'red'" ); QUnit.reset(); - var defaultText = 'Try them out:' - var result = jQuery('#first').wrap(val( document.getElementById('empty') )).parent(); - ok( result.is('ol'), 'Check for element wrapping' ); - equals( result.text(), defaultText, 'Check for element wrapping' ); + var defaultText = "Try them out:" + var result = jQuery("#first").wrap(val( document.getElementById("empty") )).parent(); + ok( result.is("ol"), "Check for element wrapping" ); + equals( result.text(), defaultText, "Check for element wrapping" ); QUnit.reset(); - jQuery('#check1').click(function() { + jQuery("#check1").click(function() { var checkbox = this; ok( checkbox.checked, "Checkbox's state is erased after wrap() action, see #769" ); - jQuery(checkbox).wrap(val( '' )); + jQuery(checkbox).wrap(val( "" )); ok( checkbox.checked, "Checkbox's state is erased after wrap() action, see #769" ); }).click(); @@ -143,17 +143,17 @@ var testWrapAll = function(val) { var prev = jQuery("#firstp")[0].previousSibling; var p = jQuery("#firstp,#first")[0].parentNode; - var result = jQuery('#firstp,#first').wrapAll(val( '
    ' )); - equals( result.parent().length, 1, 'Check for wrapping of on-the-fly html' ); - ok( jQuery('#first').parent().parent().is('.red'), 'Check if wrapper has class "red"' ); - ok( jQuery('#firstp').parent().parent().is('.red'), 'Check if wrapper has class "red"' ); + var result = jQuery("#firstp,#first").wrapAll(val( "
    " )); + equals( result.parent().length, 1, "Check for wrapping of on-the-fly html" ); + ok( jQuery("#first").parent().parent().is(".red"), "Check if wrapper has class 'red'" ); + ok( jQuery("#firstp").parent().parent().is(".red"), "Check if wrapper has class 'red'" ); equals( jQuery("#first").parent().parent()[0].previousSibling, prev, "Correct Previous Sibling" ); equals( jQuery("#first").parent().parent()[0].parentNode, p, "Correct Parent" ); QUnit.reset(); var prev = jQuery("#firstp")[0].previousSibling; var p = jQuery("#first")[0].parentNode; - var result = jQuery('#firstp,#first').wrapAll(val( document.getElementById('empty') )); + var result = jQuery("#firstp,#first").wrapAll(val( document.getElementById("empty") )); equals( jQuery("#first").parent()[0], jQuery("#firstp").parent()[0], "Same Parent" ); equals( jQuery("#first").parent()[0].previousSibling, prev, "Correct Previous Sibling" ); equals( jQuery("#first").parent()[0].parentNode, p, "Correct Parent" ); @@ -166,21 +166,21 @@ test("wrapAll(String|Element)", function() { var testWrapInner = function(val) { expect(11); var num = jQuery("#first").children().length; - var result = jQuery('#first').wrapInner(val('
    ')); + var result = jQuery("#first").wrapInner(val("
    ")); equals( jQuery("#first").children().length, 1, "Only one child" ); ok( jQuery("#first").children().is(".red"), "Verify Right Element" ); equals( jQuery("#first").children().children().children().length, num, "Verify Elements Intact" ); QUnit.reset(); var num = jQuery("#first").html("foo
    test
    test2
    ").children().length; - var result = jQuery('#first').wrapInner(val('
    ')); + var result = jQuery("#first").wrapInner(val("
    ")); equals( jQuery("#first").children().length, 1, "Only one child" ); ok( jQuery("#first").children().is(".red"), "Verify Right Element" ); equals( jQuery("#first").children().children().children().length, num, "Verify Elements Intact" ); QUnit.reset(); var num = jQuery("#first").children().length; - var result = jQuery('#first').wrapInner(val(document.getElementById('empty'))); + var result = jQuery("#first").wrapInner(val(document.getElementById("empty"))); equals( jQuery("#first").children().length, 1, "Only one child" ); ok( jQuery("#first").children().is("#empty"), "Verify Right Element" ); equals( jQuery("#first").children().children().length, num, "Verify Elements Intact" ); @@ -202,51 +202,51 @@ test("wrapInner(Function)", function() { test("unwrap()", function() { expect(9); - jQuery("body").append(' '); + jQuery("body").append(" "); - var abcd = jQuery('#unwrap1 > span, #unwrap2 > span').get(), - abcdef = jQuery('#unwrap span').get(); + var abcd = jQuery("#unwrap1 > span, #unwrap2 > span").get(), + abcdef = jQuery("#unwrap span").get(); - equals( jQuery('#unwrap1 span').add('#unwrap2 span:first').unwrap().length, 3, 'make #unwrap1 and #unwrap2 go away' ); - same( jQuery('#unwrap > span').get(), abcd, 'all four spans should still exist' ); + equals( jQuery("#unwrap1 span").add("#unwrap2 span:first").unwrap().length, 3, "make #unwrap1 and #unwrap2 go away" ); + same( jQuery("#unwrap > span").get(), abcd, "all four spans should still exist" ); - same( jQuery('#unwrap3 span').unwrap().get(), jQuery('#unwrap3 > span').get(), 'make all b in #unwrap3 go away' ); + same( jQuery("#unwrap3 span").unwrap().get(), jQuery("#unwrap3 > span").get(), "make all b in #unwrap3 go away" ); - same( jQuery('#unwrap3 span').unwrap().get(), jQuery('#unwrap > span.unwrap3').get(), 'make #unwrap3 go away' ); + same( jQuery("#unwrap3 span").unwrap().get(), jQuery("#unwrap > span.unwrap3").get(), "make #unwrap3 go away" ); - same( jQuery('#unwrap').children().get(), abcdef, '#unwrap only contains 6 child spans' ); + same( jQuery("#unwrap").children().get(), abcdef, "#unwrap only contains 6 child spans" ); - same( jQuery('#unwrap > span').unwrap().get(), jQuery('body > span.unwrap').get(), 'make the 6 spans become children of body' ); + same( jQuery("#unwrap > span").unwrap().get(), jQuery("body > span.unwrap").get(), "make the 6 spans become children of body" ); - same( jQuery('body > span.unwrap').unwrap().get(), jQuery('body > span.unwrap').get(), 'can\'t unwrap children of body' ); - same( jQuery('body > span.unwrap').unwrap().get(), abcdef, 'can\'t unwrap children of body' ); + same( jQuery("body > span.unwrap").unwrap().get(), jQuery("body > span.unwrap").get(), "can't unwrap children of body" ); + same( jQuery("body > span.unwrap").unwrap().get(), abcdef, "can't unwrap children of body" ); - same( jQuery('body > span.unwrap').get(), abcdef, 'body contains 6 .unwrap child spans' ); + same( jQuery("body > span.unwrap").get(), abcdef, "body contains 6 .unwrap child spans" ); - jQuery('body > span.unwrap').remove(); + jQuery("body > span.unwrap").remove(); }); var testAppend = function(valueObj) { expect(37); - var defaultText = 'Try them out:' - var result = jQuery('#first').append(valueObj('buga')); - equals( result.text(), defaultText + 'buga', 'Check if text appending works' ); - equals( jQuery('#select3').append(valueObj('')).find('option:last-child').attr('value'), 'appendTest', 'Appending html options to select element'); + var defaultText = "Try them out:" + var result = jQuery("#first").append(valueObj("buga")); + equals( result.text(), defaultText + "buga", "Check if text appending works" ); + equals( jQuery("#select3").append(valueObj("")).find("option:last-child").attr("value"), "appendTest", "Appending html options to select element"); QUnit.reset(); var expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:"; - jQuery('#sap').append(valueObj(document.getElementById('first'))); - equals( jQuery('#sap').text(), expected, "Check for appending of element" ); + jQuery("#sap").append(valueObj(document.getElementById("first"))); + equals( jQuery("#sap").text(), expected, "Check for appending of element" ); QUnit.reset(); expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo"; - jQuery('#sap').append(valueObj([document.getElementById('first'), document.getElementById('yahoo')])); - equals( jQuery('#sap').text(), expected, "Check for appending of array of elements" ); + jQuery("#sap").append(valueObj([document.getElementById("first"), document.getElementById("yahoo")])); + equals( jQuery("#sap").text(), expected, "Check for appending of array of elements" ); QUnit.reset(); expected = "This link has class=\"blog\": Simon Willison's WeblogYahooTry them out:"; - jQuery('#sap').append(valueObj(jQuery("#yahoo, #first"))); - equals( jQuery('#sap').text(), expected, "Check for appending of jQuery object" ); + jQuery("#sap").append(valueObj(jQuery("#yahoo, #first"))); + equals( jQuery("#sap").text(), expected, "Check for appending of jQuery object" ); QUnit.reset(); jQuery("#sap").append(valueObj( 5 )); @@ -262,25 +262,25 @@ var testAppend = function(valueObj) { ok( jQuery("#sap").append(valueObj( document.getElementsByTagName("foo") )), "Check for appending an empty nodelist." ); QUnit.reset(); - jQuery("form").append(valueObj('')); + jQuery("form").append(valueObj("")); jQuery("form input[name=radiotest]").each(function(){ - ok( jQuery(this).is(':checked'), "Append checked radio"); + ok( jQuery(this).is(":checked"), "Append checked radio"); }).remove(); QUnit.reset(); - jQuery("form").append(valueObj('')); + jQuery("form").append(valueObj("")); jQuery("form input[name=radiotest]").each(function(){ - ok( jQuery(this).is(':checked'), "Append alternately formated checked radio"); + ok( jQuery(this).is(":checked"), "Append alternately formated checked radio"); }).remove(); QUnit.reset(); - jQuery("form").append(valueObj('')); + jQuery("form").append(valueObj("")); jQuery("form input[name=radiotest]").each(function(){ - ok( jQuery(this).is(':checked'), "Append HTML5-formated checked radio"); + ok( jQuery(this).is(":checked"), "Append HTML5-formated checked radio"); }).remove(); QUnit.reset(); - jQuery("#sap").append(valueObj( document.getElementById('form') )); + jQuery("#sap").append(valueObj( document.getElementById("form") )); equals( jQuery("#sap>form").size(), 1, "Check for appending a form" ); // Bug #910 QUnit.reset(); @@ -296,31 +296,31 @@ var testAppend = function(valueObj) { ok( pass, "Test for appending a DOM node to the contents of an IFrame" ); QUnit.reset(); - jQuery('
    ').appendTo('#form').append(valueObj( 'test' )); - t( 'Append legend', '#legend', ['legend'] ); + jQuery("
    ").appendTo("#form").append(valueObj( "test" )); + t( "Append legend", "#legend", ["legend"] ); QUnit.reset(); - jQuery('#select1').append(valueObj( '' )); - equals( jQuery('#select1 option:last').text(), "Test", "Appending <OPTION> (all caps)" ); + jQuery("#select1").append(valueObj( "" )); + equals( jQuery("#select1 option:last").text(), "Test", "Appending <OPTION> (all caps)" ); - jQuery('#table').append(valueObj( '' )); - ok( jQuery('#table colgroup').length, "Append colgroup" ); + jQuery("#table").append(valueObj( "" )); + ok( jQuery("#table colgroup").length, "Append colgroup" ); - jQuery('#table colgroup').append(valueObj( '' )); - ok( jQuery('#table colgroup col').length, "Append col" ); + jQuery("#table colgroup").append(valueObj( "" )); + ok( jQuery("#table colgroup col").length, "Append col" ); QUnit.reset(); - jQuery('#table').append(valueObj( '' )); - ok( jQuery('#table caption').length, "Append caption" ); + jQuery("#table").append(valueObj( "" )); + ok( jQuery("#table caption").length, "Append caption" ); QUnit.reset(); - jQuery('form:last') - .append(valueObj( '' )) - .append(valueObj( '' )); + jQuery("form:last") + .append(valueObj( "" )) + .append(valueObj( "" )); t( "Append Select", "#appendSelect1, #appendSelect2", ["appendSelect1", "appendSelect2"] ); - equals( "Two nodes", jQuery('
    ').append("Two", " nodes").text(), "Appending two text nodes (#4011)" ); + equals( "Two nodes", jQuery("
    ").append("Two", " nodes").text(), "Appending two text nodes (#4011)" ); // using contents will get comments regular, text, and comment nodes var j = jQuery("#nonnodes").contents(); @@ -343,51 +343,51 @@ test("append(Function)", function() { test("append(Function) with incoming value", function() { expect(12); - var defaultText = 'Try them out:', old = jQuery("#first").html(); + var defaultText = "Try them out:", old = jQuery("#first").html(); - var result = jQuery('#first').append(function(i, val){ + var result = jQuery("#first").append(function(i, val){ equals( val, old, "Make sure the incoming value is correct." ); - return 'buga'; + return "buga"; }); - equals( result.text(), defaultText + 'buga', 'Check if text appending works' ); + equals( result.text(), defaultText + "buga", "Check if text appending works" ); - var select = jQuery('#select3'); + var select = jQuery("#select3"); old = select.html(); equals( select.append(function(i, val){ equals( val, old, "Make sure the incoming value is correct." ); - return ''; - }).find('option:last-child').attr('value'), 'appendTest', 'Appending html options to select element'); + return ""; + }).find("option:last-child").attr("value"), "appendTest", "Appending html options to select element"); QUnit.reset(); var expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:"; old = jQuery("#sap").html(); - jQuery('#sap').append(function(i, val){ + jQuery("#sap").append(function(i, val){ equals( val, old, "Make sure the incoming value is correct." ); - return document.getElementById('first'); + return document.getElementById("first"); }); - equals( jQuery('#sap').text(), expected, "Check for appending of element" ); + equals( jQuery("#sap").text(), expected, "Check for appending of element" ); QUnit.reset(); expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo"; old = jQuery("#sap").html(); - jQuery('#sap').append(function(i, val){ + jQuery("#sap").append(function(i, val){ equals( val, old, "Make sure the incoming value is correct." ); - return [document.getElementById('first'), document.getElementById('yahoo')]; + return [document.getElementById("first"), document.getElementById("yahoo")]; }); - equals( jQuery('#sap').text(), expected, "Check for appending of array of elements" ); + equals( jQuery("#sap").text(), expected, "Check for appending of array of elements" ); QUnit.reset(); expected = "This link has class=\"blog\": Simon Willison's WeblogYahooTry them out:"; old = jQuery("#sap").html(); - jQuery('#sap').append(function(i, val){ + jQuery("#sap").append(function(i, val){ equals( val, old, "Make sure the incoming value is correct." ); return jQuery("#yahoo, #first"); }); - equals( jQuery('#sap').text(), expected, "Check for appending of jQuery object" ); + equals( jQuery("#sap").text(), expected, "Check for appending of jQuery object" ); QUnit.reset(); old = jQuery("#sap").html(); @@ -414,11 +414,11 @@ test("append the same fragment with events (Bug #6997, 5566)", function () { if ( doExtra ) { element = jQuery("div:first").click(function () { ok(true, "Event exists on original after being unbound on clone"); - jQuery(this).unbind('click'); + jQuery(this).unbind("click"); }); - var clone = element.clone(true).unbind('click'); - clone[0].fireEvent('onclick'); - element[0].fireEvent('onclick'); + var clone = element.clone(true).unbind("click"); + clone[0].fireEvent("onclick"); + element[0].fireEvent("onclick"); // manually clean up detached elements clone.remove(); @@ -429,7 +429,7 @@ test("append the same fragment with events (Bug #6997, 5566)", function () { }); jQuery("#listWithTabIndex li").append(element) - .find('a.test6997').eq(1).click(); + .find("a.test6997").eq(1).click(); element = jQuery("
  • ").click(function () { ok(true, "Before second element events work"); @@ -443,10 +443,10 @@ test("append the same fragment with events (Bug #6997, 5566)", function () { test("appendTo(String|Element|Array<Element>|jQuery)", function() { expect(16); - var defaultText = 'Try them out:' - jQuery('buga').appendTo('#first'); - equals( jQuery("#first").text(), defaultText + 'buga', 'Check if text appending works' ); - equals( jQuery('').appendTo('#select3').parent().find('option:last-child').attr('value'), 'appendTest', 'Appending html options to select element'); + var defaultText = "Try them out:" + jQuery("buga").appendTo("#first"); + equals( jQuery("#first").text(), defaultText + "buga", "Check if text appending works" ); + equals( jQuery("").appendTo("#select3").parent().find("option:last-child").attr("value"), "appendTest", "Appending html options to select element"); QUnit.reset(); var l = jQuery("#first").children().length + 2; @@ -459,25 +459,25 @@ test("appendTo(String|Element|Array<Element>|jQuery)", function() { QUnit.reset(); var expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:"; - jQuery(document.getElementById('first')).appendTo('#sap'); - equals( jQuery('#sap').text(), expected, "Check for appending of element" ); + jQuery(document.getElementById("first")).appendTo("#sap"); + equals( jQuery("#sap").text(), expected, "Check for appending of element" ); QUnit.reset(); expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo"; - jQuery([document.getElementById('first'), document.getElementById('yahoo')]).appendTo('#sap'); - equals( jQuery('#sap').text(), expected, "Check for appending of array of elements" ); + jQuery([document.getElementById("first"), document.getElementById("yahoo")]).appendTo("#sap"); + equals( jQuery("#sap").text(), expected, "Check for appending of array of elements" ); QUnit.reset(); ok( jQuery(document.createElement("script")).appendTo("body").length, "Make sure a disconnected script can be appended." ); QUnit.reset(); expected = "This link has class=\"blog\": Simon Willison's WeblogYahooTry them out:"; - jQuery("#yahoo, #first").appendTo('#sap'); - equals( jQuery('#sap').text(), expected, "Check for appending of jQuery object" ); + jQuery("#yahoo, #first").appendTo("#sap"); + equals( jQuery("#sap").text(), expected, "Check for appending of jQuery object" ); QUnit.reset(); - jQuery('#select1').appendTo('#foo'); - t( 'Append select', '#foo select', ['select1'] ); + jQuery("#select1").appendTo("#foo"); + t( "Append select", "#foo select", ["select1"] ); QUnit.reset(); var div = jQuery("
    ").click(function(){ @@ -517,25 +517,25 @@ test("appendTo(String|Element|Array<Element>|jQuery)", function() { var testPrepend = function(val) { expect(5); - var defaultText = 'Try them out:' - var result = jQuery('#first').prepend(val( 'buga' )); - equals( result.text(), 'buga' + defaultText, 'Check if text prepending works' ); - equals( jQuery('#select3').prepend(val( '' )).find('option:first-child').attr('value'), 'prependTest', 'Prepending html options to select element'); + var defaultText = "Try them out:" + var result = jQuery("#first").prepend(val( "buga" )); + equals( result.text(), "buga" + defaultText, "Check if text prepending works" ); + equals( jQuery("#select3").prepend(val( "" )).find("option:first-child").attr("value"), "prependTest", "Prepending html options to select element"); QUnit.reset(); var expected = "Try them out:This link has class=\"blog\": Simon Willison's Weblog"; - jQuery('#sap').prepend(val( document.getElementById('first') )); - equals( jQuery('#sap').text(), expected, "Check for prepending of element" ); + jQuery("#sap").prepend(val( document.getElementById("first") )); + equals( jQuery("#sap").text(), expected, "Check for prepending of element" ); QUnit.reset(); expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog"; - jQuery('#sap').prepend(val( [document.getElementById('first'), document.getElementById('yahoo')] )); - equals( jQuery('#sap').text(), expected, "Check for prepending of array of elements" ); + jQuery("#sap").prepend(val( [document.getElementById("first"), document.getElementById("yahoo")] )); + equals( jQuery("#sap").text(), expected, "Check for prepending of array of elements" ); QUnit.reset(); expected = "YahooTry them out:This link has class=\"blog\": Simon Willison's Weblog"; - jQuery('#sap').prepend(val( jQuery("#yahoo, #first") )); - equals( jQuery('#sap').text(), expected, "Check for prepending of jQuery object" ); + jQuery("#sap").prepend(val( jQuery("#yahoo, #first") )); + equals( jQuery("#sap").text(), expected, "Check for prepending of jQuery object" ); }; test("prepend(String|Element|Array<Element>|jQuery)", function() { @@ -549,103 +549,103 @@ test("prepend(Function)", function() { test("prepend(Function) with incoming value", function() { expect(10); - var defaultText = 'Try them out:', old = jQuery('#first').html(); - var result = jQuery('#first').prepend(function(i, val) { + var defaultText = "Try them out:", old = jQuery("#first").html(); + var result = jQuery("#first").prepend(function(i, val) { equals( val, old, "Make sure the incoming value is correct." ); - return 'buga'; + return "buga"; }); - equals( result.text(), 'buga' + defaultText, 'Check if text prepending works' ); + equals( result.text(), "buga" + defaultText, "Check if text prepending works" ); old = jQuery("#select3").html(); - equals( jQuery('#select3').prepend(function(i, val) { + equals( jQuery("#select3").prepend(function(i, val) { equals( val, old, "Make sure the incoming value is correct." ); - return ''; - }).find('option:first-child').attr('value'), 'prependTest', 'Prepending html options to select element'); + return ""; + }).find("option:first-child").attr("value"), "prependTest", "Prepending html options to select element"); QUnit.reset(); var expected = "Try them out:This link has class=\"blog\": Simon Willison's Weblog"; - old = jQuery('#sap').html(); + old = jQuery("#sap").html(); - jQuery('#sap').prepend(function(i, val) { + jQuery("#sap").prepend(function(i, val) { equals( val, old, "Make sure the incoming value is correct." ); - return document.getElementById('first'); + return document.getElementById("first"); }); - equals( jQuery('#sap').text(), expected, "Check for prepending of element" ); + equals( jQuery("#sap").text(), expected, "Check for prepending of element" ); QUnit.reset(); expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog"; - old = jQuery('#sap').html(); + old = jQuery("#sap").html(); - jQuery('#sap').prepend(function(i, val) { + jQuery("#sap").prepend(function(i, val) { equals( val, old, "Make sure the incoming value is correct." ); - return [document.getElementById('first'), document.getElementById('yahoo')]; + return [document.getElementById("first"), document.getElementById("yahoo")]; }); - equals( jQuery('#sap').text(), expected, "Check for prepending of array of elements" ); + equals( jQuery("#sap").text(), expected, "Check for prepending of array of elements" ); QUnit.reset(); expected = "YahooTry them out:This link has class=\"blog\": Simon Willison's Weblog"; - old = jQuery('#sap').html(); + old = jQuery("#sap").html(); - jQuery('#sap').prepend(function(i, val) { + jQuery("#sap").prepend(function(i, val) { equals( val, old, "Make sure the incoming value is correct." ); return jQuery("#yahoo, #first"); }); - equals( jQuery('#sap').text(), expected, "Check for prepending of jQuery object" ); + equals( jQuery("#sap").text(), expected, "Check for prepending of jQuery object" ); }); test("prependTo(String|Element|Array<Element>|jQuery)", function() { expect(6); - var defaultText = 'Try them out:' - jQuery('buga').prependTo('#first'); - equals( jQuery('#first').text(), 'buga' + defaultText, 'Check if text prepending works' ); - equals( jQuery('').prependTo('#select3').parent().find('option:first-child').attr('value'), 'prependTest', 'Prepending html options to select element'); + var defaultText = "Try them out:" + jQuery("buga").prependTo("#first"); + equals( jQuery("#first").text(), "buga" + defaultText, "Check if text prepending works" ); + equals( jQuery("").prependTo("#select3").parent().find("option:first-child").attr("value"), "prependTest", "Prepending html options to select element"); QUnit.reset(); var expected = "Try them out:This link has class=\"blog\": Simon Willison's Weblog"; - jQuery(document.getElementById('first')).prependTo('#sap'); - equals( jQuery('#sap').text(), expected, "Check for prepending of element" ); + jQuery(document.getElementById("first")).prependTo("#sap"); + equals( jQuery("#sap").text(), expected, "Check for prepending of element" ); QUnit.reset(); expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog"; - jQuery([document.getElementById('first'), document.getElementById('yahoo')]).prependTo('#sap'); - equals( jQuery('#sap').text(), expected, "Check for prepending of array of elements" ); + jQuery([document.getElementById("first"), document.getElementById("yahoo")]).prependTo("#sap"); + equals( jQuery("#sap").text(), expected, "Check for prepending of array of elements" ); QUnit.reset(); expected = "YahooTry them out:This link has class=\"blog\": Simon Willison's Weblog"; - jQuery("#yahoo, #first").prependTo('#sap'); - equals( jQuery('#sap').text(), expected, "Check for prepending of jQuery object" ); + jQuery("#yahoo, #first").prependTo("#sap"); + equals( jQuery("#sap").text(), expected, "Check for prepending of jQuery object" ); QUnit.reset(); - jQuery('').prependTo('form:last'); - jQuery('').prependTo('form:last'); + jQuery("").prependTo("form:last"); + jQuery("").prependTo("form:last"); t( "Prepend Select", "#prependSelect2, #prependSelect1", ["prependSelect2", "prependSelect1"] ); }); var testBefore = function(val) { expect(6); - var expected = 'This is a normal link: bugaYahoo'; - jQuery('#yahoo').before(val( 'buga' )); - equals( jQuery('#en').text(), expected, 'Insert String before' ); + var expected = "This is a normal link: bugaYahoo"; + jQuery("#yahoo").before(val( "buga" )); + equals( jQuery("#en").text(), expected, "Insert String before" ); QUnit.reset(); expected = "This is a normal link: Try them out:Yahoo"; - jQuery('#yahoo').before(val( document.getElementById('first') )); - equals( jQuery('#en').text(), expected, "Insert element before" ); + jQuery("#yahoo").before(val( document.getElementById("first") )); + equals( jQuery("#en").text(), expected, "Insert element before" ); QUnit.reset(); expected = "This is a normal link: Try them out:diveintomarkYahoo"; - jQuery('#yahoo').before(val( [document.getElementById('first'), document.getElementById('mark')] )); - equals( jQuery('#en').text(), expected, "Insert array of elements before" ); + jQuery("#yahoo").before(val( [document.getElementById("first"), document.getElementById("mark")] )); + equals( jQuery("#en").text(), expected, "Insert array of elements before" ); QUnit.reset(); expected = "This is a normal link: diveintomarkTry them out:Yahoo"; - jQuery('#yahoo').before(val( jQuery("#mark, #first") )); - equals( jQuery('#en').text(), expected, "Insert jQuery before" ); + jQuery("#yahoo").before(val( jQuery("#mark, #first") )); + equals( jQuery("#en").text(), expected, "Insert jQuery before" ); var set = jQuery("
    ").before("test"); equals( set[0].nodeName.toLowerCase(), "span", "Insert the element before the disconnected node." ); @@ -662,46 +662,46 @@ test("before(Function)", function() { test("insertBefore(String|Element|Array<Element>|jQuery)", function() { expect(4); - var expected = 'This is a normal link: bugaYahoo'; - jQuery('buga').insertBefore('#yahoo'); - equals( jQuery('#en').text(), expected, 'Insert String before' ); + var expected = "This is a normal link: bugaYahoo"; + jQuery("buga").insertBefore("#yahoo"); + equals( jQuery("#en").text(), expected, "Insert String before" ); QUnit.reset(); expected = "This is a normal link: Try them out:Yahoo"; - jQuery(document.getElementById('first')).insertBefore('#yahoo'); - equals( jQuery('#en').text(), expected, "Insert element before" ); + jQuery(document.getElementById("first")).insertBefore("#yahoo"); + equals( jQuery("#en").text(), expected, "Insert element before" ); QUnit.reset(); expected = "This is a normal link: Try them out:diveintomarkYahoo"; - jQuery([document.getElementById('first'), document.getElementById('mark')]).insertBefore('#yahoo'); - equals( jQuery('#en').text(), expected, "Insert array of elements before" ); + jQuery([document.getElementById("first"), document.getElementById("mark")]).insertBefore("#yahoo"); + equals( jQuery("#en").text(), expected, "Insert array of elements before" ); QUnit.reset(); expected = "This is a normal link: diveintomarkTry them out:Yahoo"; - jQuery("#mark, #first").insertBefore('#yahoo'); - equals( jQuery('#en').text(), expected, "Insert jQuery before" ); + jQuery("#mark, #first").insertBefore("#yahoo"); + equals( jQuery("#en").text(), expected, "Insert jQuery before" ); }); var testAfter = function(val) { expect(6); - var expected = 'This is a normal link: Yahoobuga'; - jQuery('#yahoo').after(val( 'buga' )); - equals( jQuery('#en').text(), expected, 'Insert String after' ); + var expected = "This is a normal link: Yahoobuga"; + jQuery("#yahoo").after(val( "buga" )); + equals( jQuery("#en").text(), expected, "Insert String after" ); QUnit.reset(); expected = "This is a normal link: YahooTry them out:"; - jQuery('#yahoo').after(val( document.getElementById('first') )); - equals( jQuery('#en').text(), expected, "Insert element after" ); + jQuery("#yahoo").after(val( document.getElementById("first") )); + equals( jQuery("#en").text(), expected, "Insert element after" ); QUnit.reset(); expected = "This is a normal link: YahooTry them out:diveintomark"; - jQuery('#yahoo').after(val( [document.getElementById('first'), document.getElementById('mark')] )); - equals( jQuery('#en').text(), expected, "Insert array of elements after" ); + jQuery("#yahoo").after(val( [document.getElementById("first"), document.getElementById("mark")] )); + equals( jQuery("#en").text(), expected, "Insert array of elements after" ); QUnit.reset(); expected = "This is a normal link: YahoodiveintomarkTry them out:"; - jQuery('#yahoo').after(val( jQuery("#mark, #first") )); - equals( jQuery('#en').text(), expected, "Insert jQuery after" ); + jQuery("#yahoo").after(val( jQuery("#mark, #first") )); + equals( jQuery("#en").text(), expected, "Insert jQuery after" ); var set = jQuery("
    ").after("test"); equals( set[1].nodeName.toLowerCase(), "span", "Insert the element after the disconnected node." ); @@ -718,58 +718,58 @@ test("after(Function)", function() { test("insertAfter(String|Element|Array<Element>|jQuery)", function() { expect(4); - var expected = 'This is a normal link: Yahoobuga'; - jQuery('buga').insertAfter('#yahoo'); - equals( jQuery('#en').text(), expected, 'Insert String after' ); + var expected = "This is a normal link: Yahoobuga"; + jQuery("buga").insertAfter("#yahoo"); + equals( jQuery("#en").text(), expected, "Insert String after" ); QUnit.reset(); expected = "This is a normal link: YahooTry them out:"; - jQuery(document.getElementById('first')).insertAfter('#yahoo'); - equals( jQuery('#en').text(), expected, "Insert element after" ); + jQuery(document.getElementById("first")).insertAfter("#yahoo"); + equals( jQuery("#en").text(), expected, "Insert element after" ); QUnit.reset(); expected = "This is a normal link: YahooTry them out:diveintomark"; - jQuery([document.getElementById('first'), document.getElementById('mark')]).insertAfter('#yahoo'); - equals( jQuery('#en').text(), expected, "Insert array of elements after" ); + jQuery([document.getElementById("first"), document.getElementById("mark")]).insertAfter("#yahoo"); + equals( jQuery("#en").text(), expected, "Insert array of elements after" ); QUnit.reset(); expected = "This is a normal link: YahoodiveintomarkTry them out:"; - jQuery("#mark, #first").insertAfter('#yahoo'); - equals( jQuery('#en').text(), expected, "Insert jQuery after" ); + jQuery("#mark, #first").insertAfter("#yahoo"); + equals( jQuery("#en").text(), expected, "Insert jQuery after" ); }); var testReplaceWith = function(val) { expect(21); - jQuery('#yahoo').replaceWith(val( 'buga' )); - ok( jQuery("#replace")[0], 'Replace element with string' ); - ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after string' ); + jQuery("#yahoo").replaceWith(val( "buga" )); + ok( jQuery("#replace")[0], "Replace element with string" ); + ok( !jQuery("#yahoo")[0], "Verify that original element is gone, after string" ); QUnit.reset(); - jQuery('#yahoo').replaceWith(val( document.getElementById('first') )); - ok( jQuery("#first")[0], 'Replace element with element' ); - ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after element' ); + jQuery("#yahoo").replaceWith(val( document.getElementById("first") )); + ok( jQuery("#first")[0], "Replace element with element" ); + ok( !jQuery("#yahoo")[0], "Verify that original element is gone, after element" ); QUnit.reset(); - jQuery("#main").append('
    Foo
    '); - jQuery('#baz').replaceWith("Baz"); - equals( jQuery("#bar").text(),"Baz", 'Replace element with text' ); - ok( !jQuery("#baz")[0], 'Verify that original element is gone, after element' ); + jQuery("#main").append("
    "); + jQuery("#baz").replaceWith("Baz"); + equals( jQuery("#bar").text(),"Baz", "Replace element with text" ); + ok( !jQuery("#baz")[0], "Verify that original element is gone, after element" ); QUnit.reset(); - jQuery('#yahoo').replaceWith(val( [document.getElementById('first'), document.getElementById('mark')] )); - ok( jQuery("#first")[0], 'Replace element with array of elements' ); - ok( jQuery("#mark")[0], 'Replace element with array of elements' ); - ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after array of elements' ); + jQuery("#yahoo").replaceWith(val( [document.getElementById("first"), document.getElementById("mark")] )); + ok( jQuery("#first")[0], "Replace element with array of elements" ); + ok( jQuery("#mark")[0], "Replace element with array of elements" ); + ok( !jQuery("#yahoo")[0], "Verify that original element is gone, after array of elements" ); QUnit.reset(); - jQuery('#yahoo').replaceWith(val( jQuery("#mark, #first") )); - ok( jQuery("#first")[0], 'Replace element with set of elements' ); - ok( jQuery("#mark")[0], 'Replace element with set of elements' ); - ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after set of elements' ); + jQuery("#yahoo").replaceWith(val( jQuery("#mark, #first") )); + ok( jQuery("#first")[0], "Replace element with set of elements" ); + ok( jQuery("#mark")[0], "Replace element with set of elements" ); + ok( !jQuery("#yahoo")[0], "Verify that original element is gone, after set of elements" ); QUnit.reset(); var tmp = jQuery("
    ").appendTo("body").click(function(){ ok(true, "Newly bound click run." ); }); - var y = jQuery('
    ').appendTo("body").click(function(){ ok(true, "Previously bound click run." ); }); + var y = jQuery("
    ").appendTo("body").click(function(){ ok(true, "Previously bound click run." ); }); var child = y.append("test").find("b").click(function(){ ok(true, "Child bound click run." ); return false; }); y.replaceWith( tmp ); @@ -784,7 +784,7 @@ var testReplaceWith = function(val) { QUnit.reset(); - y = jQuery('
    ').appendTo("body").click(function(){ ok(true, "Previously bound click run." ); }); + y = jQuery("
    ").appendTo("body").click(function(){ ok(true, "Previously bound click run." ); }); var child2 = y.append("test").find("u").click(function(){ ok(true, "Child 2 bound click run." ); return false; }); y.replaceWith( child2 ); @@ -800,7 +800,7 @@ var testReplaceWith = function(val) { equals( set[0].nodeName.toLowerCase(), "span", "Replace the disconnected node." ); equals( set.length, 1, "Replace the disconnected node." ); - var non_existant = jQuery('#does-not-exist').replaceWith( val("should not throw an error") ); + var non_existant = jQuery("#does-not-exist").replaceWith( val("should not throw an error") ); equals( non_existant.length, 0, "Length of non existant element." ); var $div = jQuery("
    ").appendTo("body"); @@ -808,8 +808,8 @@ var testReplaceWith = function(val) { //$div.replaceWith("
    "); - equals(jQuery('.replacewith').length, 1, 'Check number of elements in page.'); - jQuery('.replacewith').remove(); + equals(jQuery(".replacewith").length, 1, "Check number of elements in page."); + jQuery(".replacewith").remove(); QUnit.reset(); @@ -844,35 +844,35 @@ test("replaceWith(Function)", function() { test("replaceWith(string) for more than one element", function(){ expect(3); - equals(jQuery('#foo p').length, 3, 'ensuring that test data has not changed'); + equals(jQuery("#foo p").length, 3, "ensuring that test data has not changed"); - jQuery('#foo p').replaceWith('bar'); - equals(jQuery('#foo span').length, 3, 'verify that all the three original element have been replaced'); - equals(jQuery('#foo p').length, 0, 'verify that all the three original element have been replaced'); + jQuery("#foo p").replaceWith("bar"); + equals(jQuery("#foo span").length, 3, "verify that all the three original element have been replaced"); + equals(jQuery("#foo p").length, 0, "verify that all the three original element have been replaced"); }); test("replaceAll(String|Element|Array<Element>|jQuery)", function() { expect(10); - jQuery('buga').replaceAll("#yahoo"); - ok( jQuery("#replace")[0], 'Replace element with string' ); - ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after string' ); + jQuery("buga").replaceAll("#yahoo"); + ok( jQuery("#replace")[0], "Replace element with string" ); + ok( !jQuery("#yahoo")[0], "Verify that original element is gone, after string" ); QUnit.reset(); - jQuery(document.getElementById('first')).replaceAll("#yahoo"); - ok( jQuery("#first")[0], 'Replace element with element' ); - ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after element' ); + jQuery(document.getElementById("first")).replaceAll("#yahoo"); + ok( jQuery("#first")[0], "Replace element with element" ); + ok( !jQuery("#yahoo")[0], "Verify that original element is gone, after element" ); QUnit.reset(); - jQuery([document.getElementById('first'), document.getElementById('mark')]).replaceAll("#yahoo"); - ok( jQuery("#first")[0], 'Replace element with array of elements' ); - ok( jQuery("#mark")[0], 'Replace element with array of elements' ); - ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after array of elements' ); + jQuery([document.getElementById("first"), document.getElementById("mark")]).replaceAll("#yahoo"); + ok( jQuery("#first")[0], "Replace element with array of elements" ); + ok( jQuery("#mark")[0], "Replace element with array of elements" ); + ok( !jQuery("#yahoo")[0], "Verify that original element is gone, after array of elements" ); QUnit.reset(); jQuery("#mark, #first").replaceAll("#yahoo"); - ok( jQuery("#first")[0], 'Replace element with set of elements' ); - ok( jQuery("#mark")[0], 'Replace element with set of elements' ); - ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after set of elements' ); + ok( jQuery("#first")[0], "Replace element with set of elements" ); + ok( jQuery("#mark")[0], "Replace element with set of elements" ); + ok( !jQuery("#yahoo")[0], "Verify that original element is gone, after set of elements" ); }); test("jQuery.clone() (#8017)", function() { @@ -890,9 +890,9 @@ test("jQuery.clone() (#8017)", function() { test("clone() (#8070)", function () { expect(2); - jQuery('').appendTo('#main'); - var selects = jQuery('.test8070'); - selects.append(''); + jQuery("").appendTo("#main"); + var selects = jQuery(".test8070"); + selects.append(""); equals( selects[0].childNodes.length, 2, "First select got two nodes" ); equals( selects[1].childNodes.length, 2, "Second select got two nodes" ); @@ -902,10 +902,10 @@ test("clone() (#8070)", function () { test("clone()", function() { expect(37); - equals( 'This is a normal link: Yahoo', jQuery('#en').text(), 'Assert text for #en' ); - var clone = jQuery('#yahoo').clone(); - equals( 'Try them out:Yahoo', jQuery('#first').append(clone).text(), 'Check for clone' ); - equals( 'This is a normal link: Yahoo', jQuery('#en').text(), 'Reassert text for #en' ); + equals( "This is a normal link: Yahoo", jQuery("#en").text(), "Assert text for #en" ); + var clone = jQuery("#yahoo").clone(); + equals( "Try them out:Yahoo", jQuery("#first").append(clone).text(), "Check for clone" ); + equals( "This is a normal link: Yahoo", jQuery("#en").text(), "Reassert text for #en" ); var cloneTags = [ "", "", "
    ", "
    ", @@ -915,7 +915,7 @@ test("clone()", function() { ]; for (var i = 0; i < cloneTags.length; i++) { var j = jQuery(cloneTags[i]); - equals( j[0].tagName, j.clone()[0].tagName, 'Clone a ' + cloneTags[i]); + equals( j[0].tagName, j.clone()[0].tagName, "Clone a " + cloneTags[i]); } // using contents will get comments regular, text, and comment nodes @@ -971,7 +971,7 @@ test("clone()", function() { // this is technically an invalid object, but because of the special // classid instantiation it is the only kind that IE has trouble with, // so let's test with it too. - div = jQuery("
    ").html(' '); + div = jQuery("
    ").html(" "); clone = div.clone(true); equals( clone.length, 1, "One element cloned" ); @@ -979,7 +979,7 @@ test("clone()", function() { equals( clone[0].nodeName.toUpperCase(), "DIV", "DIV element cloned" ); // and here's a valid one. - div = jQuery("
    ").html(' '); + div = jQuery("
    ").html(" "); clone = div.clone(true); equals( clone.length, 1, "One element cloned" ); @@ -1014,7 +1014,7 @@ test("clone(form element) (Bug #3879, #6655)", function() { equals( element.clone().find("option:selected").val(), element.find("option:selected").val(), "Selected option cloned correctly" ); - element = jQuery("").attr('checked', 'checked'); + element = jQuery("").attr("checked", "checked"); clone = element.clone(); equals( clone.is(":checked"), element.is(":checked"), "Checked input cloned correctly" ); @@ -1070,7 +1070,7 @@ var testHtml = function(valueObj) { } ok( pass, "Set HTML" ); - div = jQuery("
    ").html( valueObj('
    ') ); + div = jQuery("
    ").html( valueObj("
    ") ); equals( div.children().length, 2, "Make sure two child nodes exist." ); equals( div.children().children().length, 1, "Make sure that a grandchild exists." ); @@ -1090,18 +1090,18 @@ var testHtml = function(valueObj) { j.html(valueObj("bold")); // this is needed, or the expando added by jQuery unique will yield a different html - j.find('b').removeData(); + j.find("b").removeData(); equals( j.html().replace(/ xmlns="[^"]+"/g, "").toLowerCase(), "bold", "Check node,textnode,comment with html()" ); jQuery("#main").html(valueObj("