diff --git a/.jshintrc b/.jshintrc index fd498d83b..1c2f7c2b0 100644 --- a/.jshintrc +++ b/.jshintrc @@ -5,6 +5,7 @@ "expr": true, "latedef": true, "noarg": true, + "quotmark": "double", "smarttabs": true, "trailing": true, "undef": true diff --git a/grunt.js b/grunt.js index 4d94fd242..029106007 100644 --- a/grunt.js +++ b/grunt.js @@ -153,7 +153,7 @@ module.exports = function( grunt ) { }, { authUsername: config.authUsername, authToken: config.authToken, - jobName: 'jQuery commit #' + commit.substr( 0, 10 ) + '', + jobName: "jQuery commit #" + commit.substr( 0, 10 ) + "", runMax: config.runMax, "runNames[]": tests, "runUrls[]": testUrls, diff --git a/package.json b/package.json index d4585846d..ce4d9ee9e 100644 --- a/package.json +++ b/package.json @@ -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": [] diff --git a/src/.jshintrc b/src/.jshintrc index 755c86a07..d75461017 100644 --- a/src/.jshintrc +++ b/src/.jshintrc @@ -10,7 +10,8 @@ "undef": true, "smarttabs": true, "sub": true, - "maxerr": 100 + "maxerr": 100, + "quotmark": "double" }, "globals": { "define": true, diff --git a/test/.jshintrc b/test/.jshintrc index a0dfa0ccb..9068558c4 100644 --- a/test/.jshintrc +++ b/test/.jshintrc @@ -10,7 +10,8 @@ "undef": true, "smarttabs": true, "maxerr": 100, - "sub": true + "sub": true, + "quotmark": "double" }, "globals": { "define": true, diff --git a/test/unit/ajax.js b/test/unit/ajax.js index c11b8b52f..d11cb13f7 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -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" ); }); }); diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 9c3b55c21..13d680033 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -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("
"); equal( $first.attr("Case"), "mixed", "case of attribute doesn't matter" ); $first.removeAttr("Case"); diff --git a/test/unit/callbacks.js b/test/unit/callbacks.js index f0b3fdd51..6abcaf0d1 100644 --- a/test/unit/callbacks.js +++ b/test/unit/callbacks.js @@ -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( ", " ) + " }"; } diff --git a/test/unit/core.js b/test/unit/core.js index 3ca3c31fd..c0a719fe3 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -567,7 +567,7 @@ test("XSS via location.hash", function() { }; try { // This throws an error because it's processed like an id - jQuery( '#
' ).appendTo("#qunit-fixture");
+ jQuery( "#
" ).appendTo("#qunit-fixture");
} catch (err) {
jQuery["_check9521"](true);
}
diff --git a/test/unit/data.js b/test/unit/data.js
index 765aefcd2..01d042e4e 100644
--- a/test/unit/data.js
+++ b/test/unit/data.js
@@ -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("");
equal( x.data("some").foo, "bar", "got a JSON data- attribute with spaces" );
x.remove();
diff --git a/test/unit/effects.js b/test/unit/effects.js
index 366416cc2..a2dbb06b2 100644
--- a/test/unit/effects.js
+++ b/test/unit/effects.js
@@ -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(""),
- jQuery(''),
+ jQuery(""),
- jQuery('')
+ jQuery("")
];
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('');
+ elems = elems.add("");
}
foo.append( elems );
diff --git a/test/unit/event.js b/test/unit/event.js
index 667920475..e626ede1d 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -861,7 +861,7 @@ test("withinElement implemented with jQuery.contains()", function() {
expect(1);
- jQuery("#qunit-fixture").append('Gut Feeling
' ) + jQuery( "Gut Feeling
" ) .on( "click", jQuery.noop ) .on( "gutfeeling", jQuery.noop ) .off( "click" ) @@ -2716,14 +2716,14 @@ test("special bind/delegate name mapping", function() { .remove(); // Ensure special events are removed when only a namespace is provided - jQuery( 'Gut Feeling
' ) + jQuery( "Gut Feeling
" ) .on( "gutfeeling.Devo", jQuery.noop ) .off( ".Devo" ) .trigger( "gutfeeling" ) .remove(); // Ensure .one() events are removed after their maiden voyage - jQuery( 'Gut Feeling
' ) + jQuery( "Gut Feeling
" ) .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(); diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 738fdf376..669d52688 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -190,7 +190,7 @@ test("wrap(String) consecutive elements (#10177)", function() { targets.each(function() { 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" ); }); }); @@ -447,7 +447,7 @@ var testAppend = function(valueObj) { ok( jQuery("#nonnodes").contents().length >= 2, "Check node,textnode,comment append cleanup worked" ); QUnit.reset(); - var $input = jQuery("").attr({ "type": "checkbox", "checked": true }).appendTo('#testForm'); + var $input = jQuery("").attr({ "type": "checkbox", "checked": true }).appendTo("#testForm"); equal( $input[0].checked, true, "A checked checkbox that is appended stays checked" ); QUnit.reset(); @@ -746,8 +746,8 @@ test("appendTo(String|Element|Array<Element>|jQuery)", function() { if ( jQuery.getScript ) { stop(); - jQuery.getScript('data/test.js', function() { - jQuery('script[src*="data\\/test\\.js"]').remove(); + jQuery.getScript("data/test.js", function() { + jQuery("script[src*='data\\/test\\.js']").remove(); start(); }); } @@ -919,7 +919,7 @@ test("before and after w/ empty object (#10812)", function() { test("before and after on disconnected node (#10517)", function() { expect(2); - + equal( jQuery("").before("").length, 2, "before() returned all elements" ); equal( jQuery("").after("").length, 2, "after() returned all elements" ); }); @@ -1242,7 +1242,7 @@ test("clone()", function() { divEvt.remove(); // Test both html() and clone() for