Skip to content
Permalink
Browse files

enforce double quotes via JSHint. Closes gh-975

  • Loading branch information...
mikesherov authored and rwaldron committed Oct 16, 2012
1 parent 605a380 commit ed9e34482a303e7e64c397f89533dbe64f51cfbf
@@ -5,6 +5,7 @@
"expr": true,
"latedef": true,
"noarg": true,
"quotmark": "double",
"smarttabs": true,
"trailing": true,
"undef": true
@@ -153,7 +153,7 @@ module.exports = function( grunt ) {
}, {
authUsername: config.authUsername,
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,
"runNames[]": tests,
"runUrls[]": testUrls,
@@ -26,7 +26,7 @@
"grunt-compare-size": ">=0.1.0",
"grunt-git-authors": ">=1.0.0",
"grunt-update-submodules": ">=0.1.0",
"grunt": "~0.3.9",
"grunt": "~0.3.17",
"testswarm": "0.2.2"
},
"keywords": []
@@ -10,7 +10,8 @@
"undef": true,
"smarttabs": true,
"sub": true,
"maxerr": 100
"maxerr": 100,
"quotmark": "double"
},
"globals": {
"define": true,
@@ -10,7 +10,8 @@
"undef": true,
"smarttabs": true,
"maxerr": 100,
"sub": true
"sub": true,
"quotmark": "double"
},
"globals": {
"define": true,
@@ -2674,7 +2674,7 @@ if ( jQuery.ajax && ( !isLocal || hasPHP ) ) {
ok( false, "error callback called" );
}
}).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" );
});

});
@@ -516,11 +516,11 @@ test("removeAttr(String)", function() {

try {
$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) {
ok( false, "Removing contenteditable threw an error (#10429)" );
}

$first = jQuery("<div Case='mixed'></div>");
equal( $first.attr("Case"), "mixed", "case of attribute doesn't matter" );
$first.removeAttr("Case");
@@ -32,14 +32,14 @@ var output,
};
}
};

function showFlags( flags ) {
if ( typeof flags === "string" ) {
return '"' + flags + '"';
return "'" + flags + "'";
}
var output = [], key;
for ( key in flags ) {
output.push( '"' + key + '": ' + flags[ key ] );
output.push( "'" + key + "': " + flags[ key ] );
}
return "{ " + output.join( ", " ) + " }";
}
@@ -567,7 +567,7 @@ test("XSS via location.hash", function() {
};
try {
// 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) {
jQuery["_check9521"](true);
}
@@ -570,7 +570,10 @@ test("jQuery.data supports interoperable hyphenated/camelCase get/set of propert
"an-object": {},
"bool-true": true,
"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-end-2": true,
"2-num-start": true
@@ -597,7 +600,10 @@ test("jQuery.data supports interoperable removal of hyphenated/camelCase propert
"an-object": {},
"bool-true": true,
"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 );
@@ -650,7 +656,7 @@ test( "Only check element attributes once when calling .data() - #8909", functio

test( "JSON data- attributes can have newlines", function() {
expect(1);

var x = jQuery("<div data-some='{\n\"foo\":\n\t\"bar\"\n}'></div>");
equal( x.data("some").foo, "bar", "got a JSON data- attribute with spaces" );
x.remove();
@@ -429,7 +429,7 @@ asyncTest( "animate option { queue: 'name' }", function() {
order = [];

foo.animate( { width: origWidth + 100 }, {
queue: 'name',
queue: "name",
duration: 1,
complete: function() {

@@ -1369,10 +1369,10 @@ test("animate will scale margin properties individually", function() {

// clean up for next test
foo.css({
"marginLeft": '',
"marginRight": '',
"marginTop": '',
"marginBottom": ''
"marginLeft": "",
"marginRight": "",
"marginTop": "",
"marginBottom": ""
});
start();
});
@@ -1486,9 +1486,9 @@ test( "animate should set display for disconnected nodes", function() {
// parentNode = null
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" );
@@ -1532,7 +1532,7 @@ asyncTest("Animation callback should not show animated element as animated (#715
foo.animate({
opacity: 0
}, 100, function() {
ok( !foo.is(':animated'), "The element is not animated" );
ok( !foo.is(":animated"), "The element is not animated" );
start();
});
});
@@ -1563,7 +1563,7 @@ asyncTest( "hide, fadeOut and slideUp called on element width height and width =
elems = jQuery();

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 );
@@ -861,7 +861,7 @@ test("withinElement implemented with jQuery.contains()", function() {

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 ) {

@@ -934,8 +934,8 @@ test("trigger() shortcuts", function() {
elem.remove();

// 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('<v:oval id="oval" style="width:100pt;height:75pt;" fillcolor="red"> </v:oval>').appendTo('#form');
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("#oval").click().keydown();
});

@@ -1003,21 +1003,21 @@ test("trigger(type, [data], [fn])", function() {
};


$elem.live('mouseenter', function(){
ok( true, 'Trigger mouseenter bound by live' );
$elem.live("mouseenter", function(){
ok( true, "Trigger mouseenter bound by live" );
});

$elem.live('mouseleave', function(){
ok( true, 'Trigger mouseleave bound by live' );
$elem.live("mouseleave", function(){
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
// 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...
jQuery( '<img src="index.html" />' )
jQuery("<img src='index.html' />")
.appendTo( "body" )
.on( "load", function() {
ok( true, "load fired on img" );
@@ -1279,10 +1279,10 @@ test("Delegated events in SVG (#10791)", function() {
expect(2);

var svg = jQuery(
'<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 id="svg-by-id" x="10" y="20" width="100" height="60" r="10" rx="10" ry="10"></rect>'+
'</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 id='svg-by-id' x='10' y='20' width='100' height='60' r='10' rx='10' ry='10'></rect>" +
"</svg>"
).appendTo( "body" );

jQuery( "body" )
@@ -1305,9 +1305,9 @@ test("Delegated events in forms (#10844; #11145; #8165; #11382, #11764)", functi

// Alias names like "id" cause havoc
var form = jQuery(
'<form id="myform">'+
'<input type="text" name="id" value="secret agent man" />'+
'</form>'
"<form id='myform'>" +
"<input type='text' name='id' value='secret agent man' />" +
"</form>"
)
.on( "submit", function( event ) {
event.preventDefault();
@@ -1323,7 +1323,7 @@ test("Delegated events in forms (#10844; #11145; #8165; #11382, #11764)", functi
.end()
.off("submit");

form.append('<input type="text" name="disabled" value="differently abled" />');
form.append("<input type='text' name='disabled' value='differently abled' />");
jQuery("body")
.on( "submit", "#myform", function() {
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");

form
.append( '<button id="nestyDisabledBtn"><span>Zing</span></button>' )
.append( "<button id='nestyDisabledBtn'><span>Zing</span></button>" )
.on( "click", "#nestyDisabledBtn", function() {
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
var form = jQuery(
'<form id="myform">'+
'<input type="text" name="sue" value="bawls" />'+
'<input type="submit" />'+
'</form>'
"<form id='myform'>" +
"<input type='text' name='sue' value='bawls' />" +
"<input type='submit' />" +
"</form>"
)
.appendTo("body");

@@ -2255,14 +2255,14 @@ test(".delegate()/.undelegate()", function() {
test("jQuery.off using dispatched jQuery.Event", function() {
expect(1);

var markup = jQuery( '<p><a href="#">target</a></p>' ),
var markup = jQuery("<p><a href='#'>target</a></p>"),
count = 0;
markup
.on( "click.name", "a", function( event ) {
equal( ++count, 1, "event called once before removal" );
jQuery().off( event );
})
.find( "a" ).click().click().end()
.find("a").click().click().end()
.remove();
});

@@ -2708,22 +2708,22 @@ test("special bind/delegate name mapping", function() {
};

// 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( "gutfeeling", jQuery.noop )
.off( "click" )
.trigger( "gutfeeling" )
.remove();

// 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 )
.off( ".Devo" )
.trigger( "gutfeeling" )
.remove();

// Ensure .one() events are removed after their maiden voyage
jQuery( '<p>Gut Feeling</p>' )
jQuery( "<p>Gut Feeling</p>" )
.one( "gutfeeling", jQuery.noop )
.trigger( "gutfeeling" ) // This one should
.trigger( "gutfeeling" ) // This one should not
@@ -2805,7 +2805,7 @@ test("fixHooks extensions", function() {
$fixture.bind( "click", function( event ) {
ok( !("blurrinessLevel" in event), "event.blurrinessLevel does not exist" );
});
fireNative( $fixture[0], 'click' );
fireNative( $fixture[0], "click" );
$fixture.unbind( "click" );

jQuery.event.fixHooks.click = {
@@ -2819,7 +2819,7 @@ test("fixHooks extensions", function() {
$fixture.bind( "click", function( event ) {
equal( event.blurrinessLevel, 42, "event.blurrinessLevel was set" );
});
fireNative( $fixture[0], 'click' );
fireNative( $fixture[0], "click" );

delete jQuery.event.fixHooks.click;
$fixture.unbind( "click" ).remove();

0 comments on commit ed9e344

Please sign in to comment.
You can’t perform that action at this time.