From eca8ff380388c1187bc2c86e0ae7fa80aa33111e Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 18 Sep 2013 19:50:02 +0300 Subject: [PATCH] Use single quotes consistently. --- Gruntfile.js | 10 +- dist/js/bootstrap.js | 26 ++--- docs-assets/js/application.js | 16 +-- docs-assets/js/customizer.js | 36 +++---- js/.jshintrc | 1 + js/affix.js | 2 +- js/alert.js | 2 +- js/button.js | 2 +- js/carousel.js | 2 +- js/collapse.js | 2 +- js/dropdown.js | 2 +- js/modal.js | 2 +- js/popover.js | 2 +- js/scrollspy.js | 2 +- js/tab.js | 2 +- js/tests/unit/affix.js | 10 +- js/tests/unit/alert.js | 14 +-- js/tests/unit/button.js | 20 ++-- js/tests/unit/carousel.js | 34 +++--- js/tests/unit/collapse.js | 24 ++--- js/tests/unit/dropdown.js | 34 +++--- js/tests/unit/modal.js | 152 +++++++++++++------------- js/tests/unit/phantom.js | 16 +-- js/tests/unit/popover.js | 28 ++--- js/tests/unit/scrollspy.js | 10 +- js/tests/unit/tab.js | 32 +++--- js/tests/unit/tooltip.js | 198 +++++++++++++++++----------------- js/tests/unit/transition.js | 6 +- js/tooltip.js | 4 +- js/transition.js | 2 +- 30 files changed, 347 insertions(+), 346 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 3eaaacee93..f7da24f8b8 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,7 +1,7 @@ /* jshint node: true */ module.exports = function (grunt) { - "use strict"; + 'use strict'; // Force use of Unix newlines grunt.util.linefeed = '\n'; @@ -135,7 +135,7 @@ module.exports = function (grunt) { copy: { fonts: { expand: true, - src: ["fonts/*"], + src: ['fonts/*'], dest: 'dist/' } }, @@ -164,12 +164,12 @@ module.exports = function (grunt) { options: { reset: true, relaxerror: [ - "Bad value X-UA-Compatible for attribute http-equiv on element meta.", - "Element img is missing required attribute src." + 'Bad value X-UA-Compatible for attribute http-equiv on element meta.', + 'Element img is missing required attribute src.' ] }, files: { - src: ["_gh_pages/**/*.html"] + src: ['_gh_pages/**/*.html'] } }, diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index d6b01e8508..dfa3d4e246 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -26,7 +26,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) // ============================================================ @@ -83,7 +83,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // ALERT CLASS DEFINITION // ====================== @@ -182,7 +182,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // BUTTON PUBLIC CLASS DEFINITION // ============================== @@ -298,7 +298,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // CAROUSEL CLASS DEFINITION // ========================= @@ -516,7 +516,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // COLLAPSE PUBLIC CLASS DEFINITION // ================================ @@ -696,7 +696,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // DROPDOWN CLASS DEFINITION // ========================= @@ -851,7 +851,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // MODAL CLASS DEFINITION // ====================== @@ -1099,7 +1099,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // TOOLTIP PUBLIC CLASS DEFINITION // =============================== @@ -1324,7 +1324,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" } Tooltip.prototype.replaceArrow = function (delta, dimension, position) { - this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '') + this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '') } Tooltip.prototype.setContent = function () { @@ -1485,7 +1485,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // POPOVER PUBLIC CLASS DEFINITION // =============================== @@ -1603,7 +1603,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // SCROLLSPY CLASS DEFINITION // ========================== @@ -1762,7 +1762,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // TAB CLASS DEFINITION // ==================== @@ -1898,7 +1898,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // AFFIX CLASS DEFINITION // ====================== diff --git a/docs-assets/js/application.js b/docs-assets/js/application.js index 1d95de879f..ace8bddfcb 100644 --- a/docs-assets/js/application.js +++ b/docs-assets/js/application.js @@ -18,13 +18,13 @@ // // See Getting Started docs for more information if (navigator.userAgent.match(/IEMobile\/10\.0/)) { - var msViewportStyle = document.createElement("style"); + var msViewportStyle = document.createElement('style'); msViewportStyle.appendChild( document.createTextNode( - "@-ms-viewport{width:auto!important}" + '@-ms-viewport{width:auto!important}' ) ); - document.getElementsByTagName("head")[0]. + document.getElementsByTagName('head')[0]. appendChild(msViewportStyle); } @@ -73,20 +73,20 @@ // tooltip demo $('.tooltip-demo').tooltip({ - selector: "[data-toggle=tooltip]", - container: "body" + selector: '[data-toggle=tooltip]', + container: 'body' }) $('.tooltip-test').tooltip() $('.popover-test').popover() $('.bs-docs-navbar').tooltip({ - selector: "a[data-toggle=tooltip]", - container: ".bs-docs-navbar .nav" + selector: 'a[data-toggle=tooltip]', + container: '.bs-docs-navbar .nav' }) // popover demo - $("[data-toggle=popover]") + $('[data-toggle=popover]') .popover() // button state demo diff --git a/docs-assets/js/customizer.js b/docs-assets/js/customizer.js index 4d39d21707..d560769c3f 100644 --- a/docs-assets/js/customizer.js +++ b/docs-assets/js/customizer.js @@ -35,18 +35,18 @@ window.onload = function () { // wait for load in a dumb way because B-0 } function getQueryParam(key) { - key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars - var match = location.search.match(new RegExp("[?&]" + key + "=([^&]+)(&|$)")); - return match && decodeURIComponent(match[1].replace(/\+/g, " ")); + key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, '\\$&'); // escape RegEx meta chars + var match = location.search.match(new RegExp('[?&]' + key + '=([^&]+)(&|$)')); + return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); } function createGist(configJson) { var data = { - "description": "Bootstrap Customizer Config", - "public": true, - "files": { - "config.json": { - "content": configJson + 'description': 'Bootstrap Customizer Config', + 'public': true, + 'files': { + 'config.json': { + 'content': configJson } } } @@ -57,7 +57,7 @@ window.onload = function () { // wait for load in a dumb way because B-0 data: JSON.stringify(data) }) .success(function (result) { - var origin = window.location.protocol + "//" + window.location.host + var origin = window.location.protocol + '//' + window.location.host history.replaceState(false, document.title, origin + window.location.pathname + '?id=' + result.id) }) .error(function (err) { @@ -144,10 +144,10 @@ window.onload = function () { // wait for load in a dumb way because B-0 } if (config) { - zip.file("config.json", config) + zip.file('config.json', config) } - var content = zip.generate({ type: "blob" }) + var content = zip.generate({ type: 'blob' }) complete(content) } @@ -311,22 +311,22 @@ window.onload = function () { // wait for load in a dumb way because B-0 generateZip(generateCSS(), generateJavascript(), generateFonts(), configJson, function (blob) { $compileBtn.removeAttr('disabled') - saveAs(blob, "bootstrap.zip") + saveAs(blob, 'bootstrap.zip') createGist(configJson) }) }) // browser support alerts if (!window.URL && navigator.userAgent.toLowerCase().indexOf('safari') != -1) { - showCallout("Looks like you're using safari, which sadly doesn't have the best support\ - for HTML5 blobs. Because of this your file will be downloaded with the name \"untitled\".\ - However, if you check your downloads folder, just rename this \"untitled\" file\ - to \"bootstrap.zip\" and you should be good to go!") + showCallout('Looks like you\'re using safari, which sadly doesn\'t have the best support\ + for HTML5 blobs. Because of this your file will be downloaded with the name "untitled".\ + However, if you check your downloads folder, just rename this "untitled" file\ + to "bootstrap.zip" and you should be good to go!') } else if (!window.URL && !window.webkitURL) { $('.bs-docs-section, .bs-sidebar').css('display', 'none') - showCallout("Looks like your current browser doesn't support the Bootstrap Customizer. Please take a second\ - to upgrade to a more modern browser.", true) + showCallout('Looks like your current browser doesn\'t support the Bootstrap Customizer. Please take a second\ + to upgrade to a more modern browser.', true) } parseUrl() diff --git a/js/.jshintrc b/js/.jshintrc index fdfdfbbfb3..c8cccda377 100644 --- a/js/.jshintrc +++ b/js/.jshintrc @@ -10,5 +10,6 @@ "expr" : true, "laxbreak" : true, "laxcomma" : true, + "quotmark" : "single", "validthis": true } \ No newline at end of file diff --git a/js/affix.js b/js/affix.js index 552bffa3fe..0650ce3ae5 100644 --- a/js/affix.js +++ b/js/affix.js @@ -18,7 +18,7 @@ * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // AFFIX CLASS DEFINITION // ====================== diff --git a/js/alert.js b/js/alert.js index 695ad74d02..13a0cab915 100644 --- a/js/alert.js +++ b/js/alert.js @@ -18,7 +18,7 @@ * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // ALERT CLASS DEFINITION // ====================== diff --git a/js/button.js b/js/button.js index c9fdde5e48..6c66960d82 100644 --- a/js/button.js +++ b/js/button.js @@ -18,7 +18,7 @@ * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // BUTTON PUBLIC CLASS DEFINITION // ============================== diff --git a/js/carousel.js b/js/carousel.js index 6391a36df9..26f3832ff4 100644 --- a/js/carousel.js +++ b/js/carousel.js @@ -18,7 +18,7 @@ * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // CAROUSEL CLASS DEFINITION // ========================= diff --git a/js/collapse.js b/js/collapse.js index 1a079938e7..7bc9fcb425 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -18,7 +18,7 @@ * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // COLLAPSE PUBLIC CLASS DEFINITION // ================================ diff --git a/js/dropdown.js b/js/dropdown.js index b84d219bd2..3f71c7569b 100644 --- a/js/dropdown.js +++ b/js/dropdown.js @@ -18,7 +18,7 @@ * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // DROPDOWN CLASS DEFINITION // ========================= diff --git a/js/modal.js b/js/modal.js index 5544cf04e0..15b81c3623 100644 --- a/js/modal.js +++ b/js/modal.js @@ -18,7 +18,7 @@ * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // MODAL CLASS DEFINITION // ====================== diff --git a/js/popover.js b/js/popover.js index 996962aa25..d26d386b67 100644 --- a/js/popover.js +++ b/js/popover.js @@ -18,7 +18,7 @@ * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // POPOVER PUBLIC CLASS DEFINITION // =============================== diff --git a/js/scrollspy.js b/js/scrollspy.js index 2efe14fddf..8c4d13490c 100644 --- a/js/scrollspy.js +++ b/js/scrollspy.js @@ -18,7 +18,7 @@ * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // SCROLLSPY CLASS DEFINITION // ========================== diff --git a/js/tab.js b/js/tab.js index 6b0f5f6722..c584ebf982 100644 --- a/js/tab.js +++ b/js/tab.js @@ -18,7 +18,7 @@ * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { 'use strict'; // TAB CLASS DEFINITION // ==================== diff --git a/js/tests/unit/affix.js b/js/tests/unit/affix.js index b74bc51e48..6085a141e2 100644 --- a/js/tests/unit/affix.js +++ b/js/tests/unit/affix.js @@ -1,22 +1,22 @@ $(function () { - module("affix") + module('affix') - test("should provide no conflict", function () { + test('should provide no conflict', function () { var affix = $.fn.affix.noConflict() ok(!$.fn.affix, 'affix was set back to undefined (org value)') $.fn.affix = affix }) - test("should be defined on jquery object", function () { + test('should be defined on jquery object', function () { ok($(document.body).affix, 'affix method is defined') }) - test("should return element", function () { + test('should return element', function () { ok($(document.body).affix()[0] == document.body, 'document.body returned') }) - test("should exit early if element is not visible", function () { + test('should exit early if element is not visible', function () { var $affix = $('
').affix() $affix.data('bs.affix').checkPosition() ok(!$affix.hasClass('affix'), 'affix class was not added') diff --git a/js/tests/unit/alert.js b/js/tests/unit/alert.js index 98b10059e1..5e39bbab67 100644 --- a/js/tests/unit/alert.js +++ b/js/tests/unit/alert.js @@ -1,22 +1,22 @@ $(function () { - module("alert") + module('alert') - test("should provide no conflict", function () { + test('should provide no conflict', function () { var alert = $.fn.alert.noConflict() ok(!$.fn.alert, 'alert was set back to undefined (org value)') $.fn.alert = alert }) - test("should be defined on jquery object", function () { + test('should be defined on jquery object', function () { ok($(document.body).alert, 'alert method is defined') }) - test("should return element", function () { + test('should return element', function () { ok($(document.body).alert()[0] == document.body, 'document.body returned') }) - test("should fade element out on clicking .close", function () { + test('should fade element out on clicking .close', function () { var alertHTML = '
' + '×' + '

Holy guacamole! Best check yo self, you\'re not looking too good.

' @@ -28,7 +28,7 @@ $(function () { ok(!alert.hasClass('in'), 'remove .in class on .close click') }) - test("should remove element when clicking .close", function () { + test('should remove element when clicking .close', function () { $.support.transition = false var alertHTML = '
' @@ -44,7 +44,7 @@ $(function () { ok(!$('#qunit-fixture').find('.alert-message').length, 'element removed from dom') }) - test("should not fire closed when close is prevented", function () { + test('should not fire closed when close is prevented', function () { $.support.transition = false stop(); $('
') diff --git a/js/tests/unit/button.js b/js/tests/unit/button.js index 115edefafd..45397aeffb 100644 --- a/js/tests/unit/button.js +++ b/js/tests/unit/button.js @@ -1,22 +1,22 @@ $(function () { - module("button") + module('button') - test("should provide no conflict", function () { + test('should provide no conflict', function () { var button = $.fn.button.noConflict() ok(!$.fn.button, 'button was set back to undefined (org value)') $.fn.button = button }) - test("should be defined on jquery object", function () { + test('should be defined on jquery object', function () { ok($(document.body).button, 'button method is defined') }) - test("should return element", function () { + test('should return element', function () { ok($(document.body).button()[0] == document.body, 'document.body returned') }) - test("should return set state to loading", function () { + test('should return set state to loading', function () { var btn = $('') equal(btn.html(), 'mdo', 'btn text equals mdo') btn.button('loading') @@ -29,7 +29,7 @@ $(function () { }, 0) }) - test("should return reset state", function () { + test('should return reset state', function () { var btn = $('') equal(btn.html(), 'mdo', 'btn text equals mdo') btn.button('loading') @@ -51,14 +51,14 @@ $(function () { }) - test("should toggle active", function () { + test('should toggle active', function () { var btn = $('') ok(!btn.hasClass('active'), 'btn does not have active class') btn.button('toggle') ok(btn.hasClass('active'), 'btn has class active') }) - test("should toggle active when btn children are clicked", function () { + test('should toggle active when btn children are clicked', function () { var btn = $('') , inner = $('') btn @@ -69,7 +69,7 @@ $(function () { ok(btn.hasClass('active'), 'btn has class active') }) - test("should toggle active when btn children are clicked within btn-group", function () { + test('should toggle active when btn children are clicked within btn-group', function () { var btngroup = $('
') , btn = $('') , inner = $('') @@ -81,7 +81,7 @@ $(function () { ok(btn.hasClass('active'), 'btn has class active') }) - test("should check for closest matching toggle", function () { + test('should check for closest matching toggle', function () { var group = '
' + '