From ba3639b2025b8f0c510087ff8fe522c2bf0b06f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zlatan=20Vasovi=C4=87?= Date: Sun, 15 Dec 2013 20:04:32 +0100 Subject: [PATCH] Require comma on left side --- js/.jscs.json | 1 + js/carousel.js | 6 ++-- js/dropdown.js | 4 +-- js/modal.js | 6 ++-- js/popover.js | 10 +++---- js/tab.js | 4 +-- js/tests/unit/alert.js | 8 +++--- js/tests/unit/button.js | 10 +++---- js/tests/unit/dropdown.js | 56 +++++++++++++++++++------------------- js/tests/unit/popover.js | 10 +++---- js/tests/unit/scrollspy.js | 8 +++--- js/tests/unit/tooltip.js | 40 +++++++++++++-------------- js/tooltip.js | 26 +++++++++--------- js/transition.js | 8 +++--- 14 files changed, 99 insertions(+), 98 deletions(-) diff --git a/js/.jscs.json b/js/.jscs.json index e02344fd5a..e8210ccde8 100644 --- a/js/.jscs.json +++ b/js/.jscs.json @@ -1,6 +1,7 @@ { "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], "requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "requireLeftStickedOperators": [","], "disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], "requireRightStickedOperators": ["!"], "disallowRightStickedOperators": ["?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], diff --git a/js/carousel.js b/js/carousel.js index 26f3832ff4..3c2e21b6f9 100644 --- a/js/carousel.js +++ b/js/carousel.js @@ -39,9 +39,9 @@ } Carousel.DEFAULTS = { - interval: 5000 - , pause: 'hover' - , wrap: true + interval: 5000, + pause: 'hover', + wrap: true } Carousel.prototype.cycle = function (e) { diff --git a/js/dropdown.js b/js/dropdown.js index 3f71c7569b..56e9b2899a 100644 --- a/js/dropdown.js +++ b/js/dropdown.js @@ -148,7 +148,7 @@ $(document) .on('click.bs.dropdown.data-api', clearMenus) .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) - .on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle) - .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) + .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) + .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]', Dropdown.prototype.keydown) }(jQuery); diff --git a/js/modal.js b/js/modal.js index c284b4dc6a..bcb49708d2 100644 --- a/js/modal.js +++ b/js/modal.js @@ -33,9 +33,9 @@ } Modal.DEFAULTS = { - backdrop: true - , keyboard: true - , show: true + backdrop: true, + keyboard: true, + show: true } Modal.prototype.toggle = function (_relatedTarget) { diff --git a/js/popover.js b/js/popover.js index d26d386b67..0d25c839b7 100644 --- a/js/popover.js +++ b/js/popover.js @@ -29,11 +29,11 @@ if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') - Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, { - placement: 'right' - , trigger: 'click' - , content: '' - , template: '

' + Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { + placement: 'right', + trigger: 'click', + content: '', + template: '

' }) diff --git a/js/tab.js b/js/tab.js index c584ebf982..5d1b7dab1f 100644 --- a/js/tab.js +++ b/js/tab.js @@ -53,8 +53,8 @@ this.activate($this.parent('li'), $ul) this.activate($target, $target.parent(), function () { $this.trigger({ - type: 'shown.bs.tab' - , relatedTarget: previous + type: 'shown.bs.tab', + relatedTarget: previous }) }) } diff --git a/js/tests/unit/alert.js b/js/tests/unit/alert.js index 5e39bbab67..3fe2e70a36 100644 --- a/js/tests/unit/alert.js +++ b/js/tests/unit/alert.js @@ -20,8 +20,8 @@ $(function () { var alertHTML = '
' + '×' + '

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

' - + '
' - , alert = $(alertHTML).alert() + + '', + alert = $(alertHTML).alert() alert.find('.close').click() @@ -34,8 +34,8 @@ $(function () { var alertHTML = '
' + '×' + '

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

' - + '
' - , alert = $(alertHTML).appendTo('#qunit-fixture').alert() + + '', + alert = $(alertHTML).appendTo('#qunit-fixture').alert() ok($('#qunit-fixture').find('.alert-message').length, 'element added to dom') diff --git a/js/tests/unit/button.js b/js/tests/unit/button.js index 45397aeffb..104e8d8577 100644 --- a/js/tests/unit/button.js +++ b/js/tests/unit/button.js @@ -59,8 +59,8 @@ $(function () { }) test('should toggle active when btn children are clicked', function () { - var btn = $('') - , inner = $('') + var btn = $(''), + inner = $('') btn .append(inner) .appendTo($('#qunit-fixture')) @@ -70,9 +70,9 @@ $(function () { }) test('should toggle active when btn children are clicked within btn-group', function () { - var btngroup = $('
') - , btn = $('') - , inner = $('') + var btngroup = $('
'), + btn = $(''), + inner = $('') btngroup .append(btn.append(inner)) .appendTo($('#qunit-fixture')) diff --git a/js/tests/unit/dropdown.js b/js/tests/unit/dropdown.js index c94cf4fca4..34e11de1cb 100644 --- a/js/tests/unit/dropdown.js +++ b/js/tests/unit/dropdown.js @@ -28,8 +28,8 @@ $(function () { + '
  • Another link
  • ' + '' + '' - + '' - , dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click() + + '', + dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click() ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click') }) @@ -45,8 +45,8 @@ $(function () { + '
  • Another link
  • ' + '' + '' - + '' - , dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click() + + '', + dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click() ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click') }) @@ -62,8 +62,8 @@ $(function () { + '
  • Another link
  • ' + '' + '' - + '' - , dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click() + + '', + dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click() ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click') }) @@ -79,8 +79,8 @@ $(function () { + '
  • Another link
  • ' + '' + '' - + '' - , dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click() + + '', + dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click() ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click') }) @@ -97,12 +97,12 @@ $(function () { + '
  • Another link
  • ' + '' + '' - + '' - , dropdown = $(dropdownHTML) - .appendTo('#qunit-fixture') - .find('[data-toggle="dropdown"]') - .dropdown() - .click() + + '', + dropdown = $(dropdownHTML) + .appendTo('#qunit-fixture') + .find('[data-toggle="dropdown"]') + .dropdown() + .click() ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click') $('body').click() @@ -127,10 +127,10 @@ $(function () { + ' ' - + '' - , dropdowns = $(dropdownHTML).appendTo('#qunit-fixture').find('[data-toggle="dropdown"]') - , first = dropdowns.first() - , last = dropdowns.last() + + '', + dropdowns = $(dropdownHTML).appendTo('#qunit-fixture').find('[data-toggle="dropdown"]'), + first = dropdowns.first(), + last = dropdowns.last() ok(dropdowns.length == 2, 'Should be two dropdowns') @@ -160,11 +160,11 @@ $(function () { + '
  • Another link
  • ' + '' + '' - + '' - , dropdown = $(dropdownHTML) - .appendTo('#qunit-fixture') - .find('[data-toggle="dropdown"]') - .dropdown() + + '', + dropdown = $(dropdownHTML) + .appendTo('#qunit-fixture') + .find('[data-toggle="dropdown"]') + .dropdown() stop() @@ -194,11 +194,11 @@ $(function () { + '
  • Another link
  • ' + '' + '' - + '' - , dropdown = $(dropdownHTML) - .appendTo('#qunit-fixture') - .find('[data-toggle="dropdown"]') - .dropdown() + + '', + dropdown = $(dropdownHTML) + .appendTo('#qunit-fixture') + .find('[data-toggle="dropdown"]') + .dropdown() stop() diff --git a/js/tests/unit/popover.js b/js/tests/unit/popover.js index 5ed4252beb..ecab948c7d 100644 --- a/js/tests/unit/popover.js +++ b/js/tests/unit/popover.js @@ -44,8 +44,8 @@ $(function () { .popover({ title: function () { return '@fat' - } - , content: function () { + }, + content: function () { return 'loves writing tests (╯°□°)╯︵ ┻━┻' } }) @@ -102,9 +102,9 @@ $(function () { var popover = $('@fat') .appendTo('#qunit-fixture') .popover({ - title: 'Test' - , content: 'Test' - , template: '

    ' + title: 'Test', + content: 'Test', + template: '

    ' }) popover.popover('show') diff --git a/js/tests/unit/scrollspy.js b/js/tests/unit/scrollspy.js index 8ebf3dcdf5..ffc3d9a46c 100644 --- a/js/tests/unit/scrollspy.js +++ b/js/tests/unit/scrollspy.js @@ -18,8 +18,8 @@ $(function () { test('should switch active class on scroll', function () { var sectionHTML = '
    ' - , $section = $(sectionHTML).append('#qunit-fixture') - , topbarHTML = '
    ' + $section = $(sectionHTML).append('#qunit-fixture'), + topbarHTML = '
    ' + '
    ' + '
    ' + '

    Bootstrap

    ' @@ -28,8 +28,8 @@ $(function () { + '' + '
    ' + '
    ' - + '
    ' - , $topbar = $(topbarHTML).scrollspy() + + '
    ', + $topbar = $(topbarHTML).scrollspy() ok($topbar.find('.active', true)) }) diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js index dbfeacb822..d921bee7fd 100644 --- a/js/tests/unit/tooltip.js +++ b/js/tests/unit/tooltip.js @@ -299,8 +299,8 @@ $(function () { test('should place tooltip inside window', function () { var container = $('
    ').appendTo('body') - .css({position: 'absolute', width: 200, height: 200, bottom: 0, left: 0}) - , tooltip = $('Hover me') + .css({position: 'absolute', width: 200, height: 200, bottom: 0, left: 0}), + tooltip = $('Hover me') .css({position: 'absolute', top: 0, left: 0}) .appendTo(container) .tooltip({placement: 'top', animate: false}) @@ -318,13 +318,13 @@ $(function () { test('should place tooltip on top of element', function () { var container = $('
    ').appendTo('body') - .css({position: 'absolute', bottom: 0, left: 0, textAlign: 'right', width: 300, height: 300}) - , p = $('

    ').appendTo(container) - , tooltiped = $('Hover me') - .css({marginTop: 200}) - .appendTo(p) - .tooltip({placement: 'top', animate: false}) - .tooltip('show') + .css({position: 'absolute', bottom: 0, left: 0, textAlign: 'right', width: 300, height: 300}), + p = $('

    ').appendTo(container), + tooltiped = $('Hover me') + .css({marginTop: 200}) + .appendTo(p) + .tooltip({placement: 'top', animate: false}) + .tooltip('show') stop() @@ -340,12 +340,12 @@ $(function () { test('should add position class before positioning so that position-specific styles are taken into account', function () { $('head').append('') - var container = $('

    ').appendTo('body') - , target = $('') + var container = $('
    ').appendTo('body'), + target = $('') .appendTo(container) .tooltip({placement: 'right'}) - .tooltip('show') - , tooltip = container.find('.tooltip') + .tooltip('show'), + tooltip = container.find('.tooltip') ok( Math.round(target.offset().top + (target[0].offsetHeight / 2) - (tooltip[0].offsetHeight / 2)) === Math.round(tooltip.offset().top) ) target.tooltip('hide') @@ -389,13 +389,13 @@ $(function () { test('tooltips should be placed dynamically, with the dynamic placement option', function () { $.support.transition = false var ttContainer = $('
    ').css({ - 'height' : 400 - , 'overflow' : 'hidden' - , 'position' : 'absolute' - , 'top' : 0 - , 'left' : 0 - , 'width' : 600}) - .appendTo('body') + 'height' : 400, + 'overflow' : 'hidden', + 'position' : 'absolute', + 'top' : 0, + 'left' : 0, + 'width' : 600}) + .appendTo('body') var topTooltip = $('
    Top Dynamic Tooltip
    ') .appendTo('#dynamic-tt-test') diff --git a/js/tooltip.js b/js/tooltip.js index 7b10d43a2f..1cf46454b6 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -36,15 +36,15 @@ } Tooltip.DEFAULTS = { - animation: true - , placement: 'top' - , selector: false - , template: '
    ' - , trigger: 'hover focus' - , title: '' - , delay: 0 - , html: false - , container: false + animation: true, + placement: 'top', + selector: false, + template: '
    ', + trigger: 'hover focus', + title: '', + delay: 0, + html: false, + container: false } Tooltip.prototype.init = function (type, element, options) { @@ -83,8 +83,8 @@ if (options.delay && typeof options.delay == 'number') { options.delay = { - show: options.delay - , hide: options.delay + show: options.delay, + hide: options.delay } } @@ -295,8 +295,8 @@ Tooltip.prototype.getPosition = function () { var el = this.$element[0] return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : { - width: el.offsetWidth - , height: el.offsetHeight + width: el.offsetWidth, + height: el.offsetHeight }, this.$element.offset()) } diff --git a/js/transition.js b/js/transition.js index 5be3b01d43..1a842eb28b 100644 --- a/js/transition.js +++ b/js/transition.js @@ -27,10 +27,10 @@ var el = document.createElement('bootstrap') var transEndEventNames = { - 'WebkitTransition' : 'webkitTransitionEnd' - , 'MozTransition' : 'transitionend' - , 'OTransition' : 'oTransitionEnd otransitionend' - , 'transition' : 'transitionend' + 'WebkitTransition' : 'webkitTransitionEnd', + 'MozTransition' : 'transitionend', + 'OTransition' : 'oTransitionEnd otransitionend', + 'transition' : 'transitionend' } for (var name in transEndEventNames) {