enforce double quotes via JSHint. Closes gh-975

This commit is contained in:
Mike Sherov 2012-10-16 10:17:14 -04:00 committed by Rick Waldron
parent 605a38073e
commit ed9e34482a
16 changed files with 116 additions and 107 deletions

View File

@ -5,6 +5,7 @@
"expr": true, "expr": true,
"latedef": true, "latedef": true,
"noarg": true, "noarg": true,
"quotmark": "double",
"smarttabs": true, "smarttabs": true,
"trailing": true, "trailing": true,
"undef": true "undef": true

View File

@ -153,7 +153,7 @@ module.exports = function( grunt ) {
}, { }, {
authUsername: config.authUsername, authUsername: config.authUsername,
authToken: config.authToken, authToken: config.authToken,
jobName: 'jQuery commit #<a href="https://github.com/jquery/jquery/commit/' + commit + '">' + commit.substr( 0, 10 ) + '</a>', jobName: "jQuery commit #<a href='https://github.com/jquery/jquery/commit/" + commit + "'>" + commit.substr( 0, 10 ) + "</a>",
runMax: config.runMax, runMax: config.runMax,
"runNames[]": tests, "runNames[]": tests,
"runUrls[]": testUrls, "runUrls[]": testUrls,

View File

@ -26,7 +26,7 @@
"grunt-compare-size": ">=0.1.0", "grunt-compare-size": ">=0.1.0",
"grunt-git-authors": ">=1.0.0", "grunt-git-authors": ">=1.0.0",
"grunt-update-submodules": ">=0.1.0", "grunt-update-submodules": ">=0.1.0",
"grunt": "~0.3.9", "grunt": "~0.3.17",
"testswarm": "0.2.2" "testswarm": "0.2.2"
}, },
"keywords": [] "keywords": []

View File

@ -10,7 +10,8 @@
"undef": true, "undef": true,
"smarttabs": true, "smarttabs": true,
"sub": true, "sub": true,
"maxerr": 100 "maxerr": 100,
"quotmark": "double"
}, },
"globals": { "globals": {
"define": true, "define": true,

View File

@ -10,7 +10,8 @@
"undef": true, "undef": true,
"smarttabs": true, "smarttabs": true,
"maxerr": 100, "maxerr": 100,
"sub": true "sub": true,
"quotmark": "double"
}, },
"globals": { "globals": {
"define": true, "define": true,

View File

@ -2674,7 +2674,7 @@ if ( jQuery.ajax && ( !isLocal || hasPHP ) ) {
ok( false, "error callback called" ); ok( false, "error callback called" );
} }
}).fail(function( _, reason ) { }).fail(function( _, reason ) {
strictEqual( reason, 'canceled', "Request aborted by the prefilter must fail with 'canceled' status text" ); strictEqual( reason, "canceled", "Request aborted by the prefilter must fail with 'canceled' status text" );
}); });
}); });

View File

@ -516,7 +516,7 @@ test("removeAttr(String)", function() {
try { try {
$first = jQuery("#first").attr("contenteditable", "true").removeAttr("contenteditable"); $first = jQuery("#first").attr("contenteditable", "true").removeAttr("contenteditable");
equal( $first.attr('contenteditable'), undefined, "Remove the contenteditable attribute" ); equal( $first.attr("contenteditable"), undefined, "Remove the contenteditable attribute" );
} catch(e) { } catch(e) {
ok( false, "Removing contenteditable threw an error (#10429)" ); ok( false, "Removing contenteditable threw an error (#10429)" );
} }

View File

@ -35,11 +35,11 @@ var output,
function showFlags( flags ) { function showFlags( flags ) {
if ( typeof flags === "string" ) { if ( typeof flags === "string" ) {
return '"' + flags + '"'; return "'" + flags + "'";
} }
var output = [], key; var output = [], key;
for ( key in flags ) { for ( key in flags ) {
output.push( '"' + key + '": ' + flags[ key ] ); output.push( "'" + key + "': " + flags[ key ] );
} }
return "{ " + output.join( ", " ) + " }"; return "{ " + output.join( ", " ) + " }";
} }

View File

@ -567,7 +567,7 @@ test("XSS via location.hash", function() {
}; };
try { try {
// This throws an error because it's processed like an id // This throws an error because it's processed like an id
jQuery( '#<img id="check9521" src="no-such-.gif" onerror="jQuery._check9521(false)">' ).appendTo("#qunit-fixture"); jQuery( "#<img id='check9521' src='no-such-.gif' onerror='jQuery._check9521(false)'>" ).appendTo("#qunit-fixture");
} catch (err) { } catch (err) {
jQuery["_check9521"](true); jQuery["_check9521"](true);
} }

View File

@ -570,7 +570,10 @@ test("jQuery.data supports interoperable hyphenated/camelCase get/set of propert
"an-object": {}, "an-object": {},
"bool-true": true, "bool-true": true,
"bool-false": false, "bool-false": false,
"some-json": '{ "foo": "bar" }', // JSHint enforces double quotes,
// but JSON strings need double quotes to parse
// so we need escaped double quotes here
"some-json": "{ \"foo\": \"bar\" }",
"num-1-middle": true, "num-1-middle": true,
"num-end-2": true, "num-end-2": true,
"2-num-start": true "2-num-start": true
@ -597,7 +600,10 @@ test("jQuery.data supports interoperable removal of hyphenated/camelCase propert
"an-object": {}, "an-object": {},
"bool-true": true, "bool-true": true,
"bool-false": false, "bool-false": false,
"some-json": '{ "foo": "bar" }' // JSHint enforces double quotes,
// but JSON strings need double quotes to parse
// so we need escaped double quotes here
"some-json": "{ \"foo\": \"bar\" }"
}; };
expect( 27 ); expect( 27 );

18
test/unit/effects.js vendored
View File

@ -429,7 +429,7 @@ asyncTest( "animate option { queue: 'name' }", function() {
order = []; order = [];
foo.animate( { width: origWidth + 100 }, { foo.animate( { width: origWidth + 100 }, {
queue: 'name', queue: "name",
duration: 1, duration: 1,
complete: function() { complete: function() {
@ -1369,10 +1369,10 @@ test("animate will scale margin properties individually", function() {
// clean up for next test // clean up for next test
foo.css({ foo.css({
"marginLeft": '', "marginLeft": "",
"marginRight": '', "marginRight": "",
"marginTop": '', "marginTop": "",
"marginBottom": '' "marginBottom": ""
}); });
start(); start();
}); });
@ -1486,9 +1486,9 @@ test( "animate should set display for disconnected nodes", function() {
// parentNode = null // parentNode = null
jQuery("<div/>"), jQuery("<div/>"),
jQuery('<div style="display:inline"/>'), jQuery("<div style='display:inline'/>"),
jQuery('<div style="display:none"/>') jQuery("<div style='display:none'/>")
]; ];
strictEqual( elems[ 0 ].show()[ 0 ].style.display, "block", "set display with show() for element with parentNode = document fragment" ); strictEqual( elems[ 0 ].show()[ 0 ].style.display, "block", "set display with show() for element with parentNode = document fragment" );
@ -1532,7 +1532,7 @@ asyncTest("Animation callback should not show animated element as animated (#715
foo.animate({ foo.animate({
opacity: 0 opacity: 0
}, 100, function() { }, 100, function() {
ok( !foo.is(':animated'), "The element is not animated" ); ok( !foo.is(":animated"), "The element is not animated" );
start(); start();
}); });
}); });
@ -1563,7 +1563,7 @@ asyncTest( "hide, fadeOut and slideUp called on element width height and width =
elems = jQuery(); elems = jQuery();
for ( ; i < 5; i++ ) { for ( ; i < 5; i++ ) {
elems = elems.add('<div style="width:0;height:0;"></div>'); elems = elems.add("<div style='width:0;height:0;'></div>");
} }
foo.append( elems ); foo.append( elems );

View File

@ -861,7 +861,7 @@ test("withinElement implemented with jQuery.contains()", function() {
expect(1); expect(1);
jQuery("#qunit-fixture").append('<div id="jc-outer"><div id="jc-inner"></div></div>'); jQuery("#qunit-fixture").append("<div id='jc-outer'><div id='jc-inner'></div></div>");
jQuery("#jc-outer").bind("mouseenter mouseleave", function( event ) { jQuery("#jc-outer").bind("mouseenter mouseleave", function( event ) {
@ -934,8 +934,8 @@ test("trigger() shortcuts", function() {
elem.remove(); elem.remove();
// test that special handlers do not blow up with VML elements (#7071) // test that special handlers do not blow up with VML elements (#7071)
jQuery('<xml:namespace ns="urn:schemas-microsoft-com:vml" prefix="v" />').appendTo('head'); jQuery("<xml:namespace ns='urn:schemas-microsoft-com:vml' prefix='v' />").appendTo("head");
jQuery('<v:oval id="oval" style="width:100pt;height:75pt;" fillcolor="red"> </v:oval>').appendTo('#form'); jQuery("<v:oval id='oval' style='width:100pt;height:75pt;' fillcolor='red'> </v:oval>").appendTo("#form");
jQuery("#oval").click().keydown(); jQuery("#oval").click().keydown();
}); });
@ -1003,21 +1003,21 @@ test("trigger(type, [data], [fn])", function() {
}; };
$elem.live('mouseenter', function(){ $elem.live("mouseenter", function(){
ok( true, 'Trigger mouseenter bound by live' ); ok( true, "Trigger mouseenter bound by live" );
}); });
$elem.live('mouseleave', function(){ $elem.live("mouseleave", function(){
ok( true, 'Trigger mouseleave bound by live' ); ok( true, "Trigger mouseleave bound by live" );
}); });
$elem.trigger('mouseenter'); $elem.trigger("mouseenter");
$elem.trigger('mouseleave'); $elem.trigger("mouseleave");
$elem.die('mouseenter'); $elem.die("mouseenter");
$elem.die('mouseleave'); $elem.die("mouseleave");
// Triggers handlrs and native // Triggers handlrs and native
// Trigger 5 // Trigger 5
@ -1264,7 +1264,7 @@ test(".trigger() doesn't bubble load event (#10717)", function() {
}); });
// It's not an image, but as long as it fires load... // It's not an image, but as long as it fires load...
jQuery( '<img src="index.html" />' ) jQuery("<img src='index.html' />")
.appendTo( "body" ) .appendTo( "body" )
.on( "load", function() { .on( "load", function() {
ok( true, "load fired on img" ); ok( true, "load fired on img" );
@ -1279,10 +1279,10 @@ test("Delegated events in SVG (#10791)", function() {
expect(2); expect(2);
var svg = jQuery( var svg = jQuery(
'<svg height="1" version="1.1" width="1" xmlns="http://www.w3.org/2000/svg">'+ "<svg height='1' version='1.1' width='1' xmlns='http://www.w3.org/2000/svg'>" +
'<rect class="svg-by-class" x="10" y="20" width="100" height="60" r="10" rx="10" ry="10"></rect>'+ "<rect class='svg-by-class' x='10' y='20' width='100' height='60' r='10' rx='10' ry='10'></rect>" +
'<rect id="svg-by-id" x="10" y="20" width="100" height="60" r="10" rx="10" ry="10"></rect>'+ "<rect id='svg-by-id' x='10' y='20' width='100' height='60' r='10' rx='10' ry='10'></rect>" +
'</svg>' "</svg>"
).appendTo( "body" ); ).appendTo( "body" );
jQuery( "body" ) jQuery( "body" )
@ -1305,9 +1305,9 @@ test("Delegated events in forms (#10844; #11145; #8165; #11382, #11764)", functi
// Alias names like "id" cause havoc // Alias names like "id" cause havoc
var form = jQuery( var form = jQuery(
'<form id="myform">'+ "<form id='myform'>" +
'<input type="text" name="id" value="secret agent man" />'+ "<input type='text' name='id' value='secret agent man' />" +
'</form>' "</form>"
) )
.on( "submit", function( event ) { .on( "submit", function( event ) {
event.preventDefault(); event.preventDefault();
@ -1323,7 +1323,7 @@ test("Delegated events in forms (#10844; #11145; #8165; #11382, #11764)", functi
.end() .end()
.off("submit"); .off("submit");
form.append('<input type="text" name="disabled" value="differently abled" />'); form.append("<input type='text' name='disabled' value='differently abled' />");
jQuery("body") jQuery("body")
.on( "submit", "#myform", function() { .on( "submit", "#myform", function() {
ok( true, "delegated id selector with aliased disabled" ); ok( true, "delegated id selector with aliased disabled" );
@ -1334,7 +1334,7 @@ test("Delegated events in forms (#10844; #11145; #8165; #11382, #11764)", functi
.off("submit"); .off("submit");
form form
.append( '<button id="nestyDisabledBtn"><span>Zing</span></button>' ) .append( "<button id='nestyDisabledBtn'><span>Zing</span></button>" )
.on( "click", "#nestyDisabledBtn", function() { .on( "click", "#nestyDisabledBtn", function() {
ok( true, "click on enabled/disabled button with nesty elements" ); ok( true, "click on enabled/disabled button with nesty elements" );
}) })
@ -1360,10 +1360,10 @@ test("Submit event can be stopped (#11049)", function() {
// Since we manually bubble in IE, make sure inner handlers get a chance to cancel // Since we manually bubble in IE, make sure inner handlers get a chance to cancel
var form = jQuery( var form = jQuery(
'<form id="myform">'+ "<form id='myform'>" +
'<input type="text" name="sue" value="bawls" />'+ "<input type='text' name='sue' value='bawls' />" +
'<input type="submit" />'+ "<input type='submit' />" +
'</form>' "</form>"
) )
.appendTo("body"); .appendTo("body");
@ -2255,7 +2255,7 @@ test(".delegate()/.undelegate()", function() {
test("jQuery.off using dispatched jQuery.Event", function() { test("jQuery.off using dispatched jQuery.Event", function() {
expect(1); expect(1);
var markup = jQuery( '<p><a href="#">target</a></p>' ), var markup = jQuery("<p><a href='#'>target</a></p>"),
count = 0; count = 0;
markup markup
.on( "click.name", "a", function( event ) { .on( "click.name", "a", function( event ) {
@ -2708,7 +2708,7 @@ test("special bind/delegate name mapping", function() {
}; };
// Ensure a special event isn't removed by its mapped type // Ensure a special event isn't removed by its mapped type
jQuery( '<p>Gut Feeling</p>' ) jQuery( "<p>Gut Feeling</p>" )
.on( "click", jQuery.noop ) .on( "click", jQuery.noop )
.on( "gutfeeling", jQuery.noop ) .on( "gutfeeling", jQuery.noop )
.off( "click" ) .off( "click" )
@ -2716,14 +2716,14 @@ test("special bind/delegate name mapping", function() {
.remove(); .remove();
// Ensure special events are removed when only a namespace is provided // Ensure special events are removed when only a namespace is provided
jQuery( '<p>Gut Feeling</p>' ) jQuery( "<p>Gut Feeling</p>" )
.on( "gutfeeling.Devo", jQuery.noop ) .on( "gutfeeling.Devo", jQuery.noop )
.off( ".Devo" ) .off( ".Devo" )
.trigger( "gutfeeling" ) .trigger( "gutfeeling" )
.remove(); .remove();
// Ensure .one() events are removed after their maiden voyage // Ensure .one() events are removed after their maiden voyage
jQuery( '<p>Gut Feeling</p>' ) jQuery( "<p>Gut Feeling</p>" )
.one( "gutfeeling", jQuery.noop ) .one( "gutfeeling", jQuery.noop )
.trigger( "gutfeeling" ) // This one should .trigger( "gutfeeling" ) // This one should
.trigger( "gutfeeling" ) // This one should not .trigger( "gutfeeling" ) // This one should not
@ -2805,7 +2805,7 @@ test("fixHooks extensions", function() {
$fixture.bind( "click", function( event ) { $fixture.bind( "click", function( event ) {
ok( !("blurrinessLevel" in event), "event.blurrinessLevel does not exist" ); ok( !("blurrinessLevel" in event), "event.blurrinessLevel does not exist" );
}); });
fireNative( $fixture[0], 'click' ); fireNative( $fixture[0], "click" );
$fixture.unbind( "click" ); $fixture.unbind( "click" );
jQuery.event.fixHooks.click = { jQuery.event.fixHooks.click = {
@ -2819,7 +2819,7 @@ test("fixHooks extensions", function() {
$fixture.bind( "click", function( event ) { $fixture.bind( "click", function( event ) {
equal( event.blurrinessLevel, 42, "event.blurrinessLevel was set" ); equal( event.blurrinessLevel, 42, "event.blurrinessLevel was set" );
}); });
fireNative( $fixture[0], 'click' ); fireNative( $fixture[0], "click" );
delete jQuery.event.fixHooks.click; delete jQuery.event.fixHooks.click;
$fixture.unbind( "click" ).remove(); $fixture.unbind( "click" ).remove();

View File

@ -190,7 +190,7 @@ test("wrap(String) consecutive elements (#10177)", function() {
targets.each(function() { targets.each(function() {
var $this = jQuery(this); var $this = jQuery(this);
ok( $this.parent().is('.wrapper'), "Check each elements parent is correct (.wrapper)" ); ok( $this.parent().is(".wrapper"), "Check each elements parent is correct (.wrapper)" );
equal( $this.siblings().length, 0, "Each element should be wrapped individually" ); equal( $this.siblings().length, 0, "Each element should be wrapped individually" );
}); });
}); });
@ -447,7 +447,7 @@ var testAppend = function(valueObj) {
ok( jQuery("#nonnodes").contents().length >= 2, "Check node,textnode,comment append cleanup worked" ); ok( jQuery("#nonnodes").contents().length >= 2, "Check node,textnode,comment append cleanup worked" );
QUnit.reset(); QUnit.reset();
var $input = jQuery("<input />").attr({ "type": "checkbox", "checked": true }).appendTo('#testForm'); var $input = jQuery("<input />").attr({ "type": "checkbox", "checked": true }).appendTo("#testForm");
equal( $input[0].checked, true, "A checked checkbox that is appended stays checked" ); equal( $input[0].checked, true, "A checked checkbox that is appended stays checked" );
QUnit.reset(); QUnit.reset();
@ -746,8 +746,8 @@ test("appendTo(String|Element|Array&lt;Element&gt;|jQuery)", function() {
if ( jQuery.getScript ) { if ( jQuery.getScript ) {
stop(); stop();
jQuery.getScript('data/test.js', function() { jQuery.getScript("data/test.js", function() {
jQuery('script[src*="data\\/test\\.js"]').remove(); jQuery("script[src*='data\\/test\\.js']").remove();
start(); start();
}); });
} }
@ -1242,7 +1242,7 @@ test("clone()", function() {
divEvt.remove(); divEvt.remove();
// Test both html() and clone() for <embed and <object types // Test both html() and clone() for <embed and <object types
div = jQuery("<div/>").html('<embed height="355" width="425" src="http://www.youtube.com/v/3KANI2dpXLw&amp;hl=en"></embed>'); div = jQuery("<div/>").html("<embed height='355' width='425' src='http://www.youtube.com/v/3KANI2dpXLw&amp;hl=en'></embed>");
clone = div.clone(true); clone = div.clone(true);
equal( clone.length, 1, "One element cloned" ); equal( clone.length, 1, "One element cloned" );
@ -1713,25 +1713,25 @@ test("jQuery.buildFragment - no plain-text caching (Bug #6779)", function() {
test( "jQuery.html - execute scripts escaped with html comment or CDATA (#9221)", function() { test( "jQuery.html - execute scripts escaped with html comment or CDATA (#9221)", function() {
expect( 3 ); expect( 3 );
jQuery( [ jQuery( [
'<script type="text/javascript">', "<script type='text/javascript'>",
'<!--', "<!--",
'ok( true, "<!-- handled" );', "ok( true, '<!-- handled' );",
'//-->', "//-->",
'</script>' "</script>"
].join ( "\n" ) ).appendTo( "#qunit-fixture" ); ].join ( "\n" ) ).appendTo( "#qunit-fixture" );
jQuery( [ jQuery( [
'<script type="text/javascript">', "<script type='text/javascript'>",
'<![CDATA[', "<![CDATA[",
'ok( true, "<![CDATA[ handled" );', "ok( true, '<![CDATA[ handled' );",
'//]]>', "//]]>",
'</script>' "</script>"
].join ( "\n" ) ).appendTo( "#qunit-fixture" ); ].join ( "\n" ) ).appendTo( "#qunit-fixture" );
jQuery( [ jQuery( [
'<script type="text/javascript">', "<script type='text/javascript'>",
'<!--//--><![CDATA[//><!--', "<!--//--><![CDATA[//><!--",
'ok( true, "<!--//--><![CDATA[//><!-- (Drupal case) handled" );', "ok( true, '<!--//--><![CDATA[//><!-- (Drupal case) handled' );",
'//--><!]]>', "//--><!]]>",
'</script>' "</script>"
].join ( "\n" ) ).appendTo( "#qunit-fixture" ); ].join ( "\n" ) ).appendTo( "#qunit-fixture" );
}); });
@ -1739,7 +1739,7 @@ test("jQuery.buildFragment - plain objects are not a document #8950", function()
expect(1); expect(1);
try { try {
jQuery('<input type="hidden">', {}); jQuery("<input type='hidden'>", {});
ok( true, "Does not allow attribute object to be treated like a doc object"); ok( true, "Does not allow attribute object to be treated like a doc object");
} catch (e) {} } catch (e) {}

View File

@ -476,15 +476,15 @@ test("offsetParent", function(){
test("fractions (see #7730 and #7885)", function() { test("fractions (see #7730 and #7885)", function() {
expect(2); expect(2);
jQuery('body').append('<div id="fractions"/>'); jQuery("body").append("<div id='fractions'/>");
var expected = { "top": 1000, "left": 1000 }; var expected = { "top": 1000, "left": 1000 };
var div = jQuery('#fractions'); var div = jQuery("#fractions");
div.css({ div.css({
"position": 'absolute', "position": "absolute",
"left": '1000.7432222px', "left": "1000.7432222px",
"top": '1000.532325px', "top": "1000.532325px",
"width": 100, "width": 100,
"height": 100 "height": 100
}); });

View File

@ -48,30 +48,30 @@ if ( jQuery.css ) {
t( "Is Not Hidden", "#qunit-fixture:hidden", [] ); t( "Is Not Hidden", "#qunit-fixture:hidden", [] );
t( "Is Hidden", "#form input:hidden", ["hidden1","hidden2"] ); t( "Is Hidden", "#form input:hidden", ["hidden1","hidden2"] );
var $div = jQuery('<div/>').appendTo("body"); var $div = jQuery("<div/>").appendTo("body");
$div.css({ fontSize: 0, lineHeight: 0 });// IE also needs to set font-size and line-height to 0 $div.css({ fontSize: 0, lineHeight: 0 });// IE also needs to set font-size and line-height to 0
$div.css( "width", 1 ).css( "height", 0 ); $div.css( "width", 1 ).css( "height", 0 );
t( "Is Visible", '#nothiddendivchild:visible', ['nothiddendivchild'] ); t( "Is Visible", "#nothiddendivchild:visible", ["nothiddendivchild"] );
t( "Is Not Visible", '#nothiddendivchild:hidden', [] ); t( "Is Not Visible", "#nothiddendivchild:hidden", [] );
$div.css( "width", 0 ).css( "height", 1 ); $div.css( "width", 0 ).css( "height", 1 );
t( "Is Visible", '#nothiddendivchild:visible', ['nothiddendivchild'] ); t( "Is Visible", "#nothiddendivchild:visible", ["nothiddendivchild"] );
t( "Is Not Visible", '#nothiddendivchild:hidden', [] ); t( "Is Not Visible", "#nothiddendivchild:hidden", [] );
$div.css( "width", 1 ).css( "height", 1 ); $div.css( "width", 1 ).css( "height", 1 );
t( "Is Visible", '#nothiddendivchild:visible', ['nothiddendivchild'] ); t( "Is Visible", "#nothiddendivchild:visible", ["nothiddendivchild"] );
t( "Is Not Visible", '#nothiddendivchild:hidden', [] ); t( "Is Not Visible", "#nothiddendivchild:hidden", [] );
$div.remove(); $div.remove();
}); });
} }
test("disconnected nodes", function() { test("disconnected nodes", function() {
expect( 4 ); expect( 4 );
var $opt = jQuery('<option></option>').attr("value", "whipit").appendTo("#qunit-fixture").detach(); var $opt = jQuery("<option></option>").attr("value", "whipit").appendTo("#qunit-fixture").detach();
equal( $opt.val(), "whipit", "option value" ); equal( $opt.val(), "whipit", "option value" );
equal( $opt.is(":selected"), false, "unselected option" ); equal( $opt.is(":selected"), false, "unselected option" );
$opt.attr("selected", true); $opt.attr("selected", true);
equal( $opt.is(":selected"), true, "selected option" ); equal( $opt.is(":selected"), true, "selected option" );
var $div = jQuery( '<div/>' ); var $div = jQuery("<div/>");
equal( $div.is("div"), true, "Make sure .is('nodeName') works on disconnect nodes." ); equal( $div.is("div"), true, "Make sure .is('nodeName') works on disconnect nodes." );
}); });
@ -105,7 +105,7 @@ testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQue
i = 0; i = 0;
for ( ; i < f.length; i++ ) { for ( ; i < f.length; i++ ) {
s += (s && ",") + '"' + f[i].id + '"'; s += (s && ",") + "'" + f[i].id + "'";
} }
deepEqual(f, q.apply( q, c ), a + " (" + b + ")"); deepEqual(f, q.apply( q, c ), a + " (" + b + ")");
@ -167,7 +167,7 @@ testIframe("selector/sizzle_cache", "Sizzle cache collides with multiple Sizzles
var $cached = window["$cached"]; var $cached = window["$cached"];
expect(3); expect(3);
deepEqual( $cached('.test a').get(), [ document.getElementById('collision') ], "Select collision anchor with first sizzle" ); deepEqual( $cached(".test a").get(), [ document.getElementById("collision") ], "Select collision anchor with first sizzle" );
equal( jQuery('.evil a').length, 0, "Select nothing with second sizzle" ); equal( jQuery(".evil a").length, 0, "Select nothing with second sizzle" );
equal( jQuery('.evil a').length, 0, "Select nothing again with second sizzle" ); equal( jQuery(".evil a").length, 0, "Select nothing again with second sizzle" );
}); });

View File

@ -107,7 +107,7 @@ test("is() with positional selectors", function() {
expect(23); expect(23);
var html = jQuery( var html = jQuery(
'<p id="posp"><a class="firsta" href="#"><em>first</em></a><a class="seconda" href="#"><b>test</b></a><em></em></p>' "<p id='posp'><a class='firsta' href='#'><em>first</em></a><a class='seconda' href='#'><b>test</b></a><em></em></p>"
).appendTo( "body" ), ).appendTo( "body" ),
isit = function(sel, match, expect) { isit = function(sel, match, expect) {
equal( jQuery( sel ).is( match ), expect, "jQuery( " + sel + " ).is( " + match + " )" ); equal( jQuery( sel ).is( match ), expect, "jQuery( " + sel + " ).is( " + match + " )" );
@ -234,16 +234,16 @@ test("filter(jQuery)", function() {
test("filter() with positional selectors", function() { test("filter() with positional selectors", function() {
expect(19); expect(19);
var html = jQuery('' + var html = jQuery( "" +
'<p id="posp">' + "<p id='posp'>" +
'<a class="firsta" href="#">' + "<a class='firsta' href='#'>" +
'<em>first</em>' + "<em>first</em>" +
'</a>' + "</a>" +
'<a class="seconda" href="#">' + "<a class='seconda' href='#'>" +
'<b>test</b>' + "<b>test</b>" +
'</a>' + "</a>" +
'<em></em>' + "<em></em>" +
'</p>').appendTo( "body" ), "</p>" ).appendTo( "body" ),
filterit = function(sel, filter, length) { filterit = function(sel, filter, length) {
equal( jQuery( sel ).filter( filter ).length, length, "jQuery( " + sel + " ).filter( " + filter + " )" ); equal( jQuery( sel ).filter( filter ).length, length, "jQuery( " + sel + " ).filter( " + filter + " )" );
}; };