diff options
Diffstat (limited to 'js')
| -rw-r--r-- | js/affix.js | 4 | ||||
| -rw-r--r-- | js/alert.js | 4 | ||||
| -rw-r--r-- | js/button.js | 18 | ||||
| -rw-r--r-- | js/carousel.js | 12 | ||||
| -rw-r--r-- | js/collapse.js | 4 | ||||
| -rw-r--r-- | js/dropdown.js | 10 | ||||
| -rw-r--r-- | js/modal.js | 4 | ||||
| -rw-r--r-- | js/popover.js | 4 | ||||
| -rw-r--r-- | js/scrollspy.js | 6 | ||||
| -rw-r--r-- | js/tab.js | 4 | ||||
| -rw-r--r-- | js/tests/unit/button.js | 6 | ||||
| -rw-r--r-- | js/tooltip.js | 4 | ||||
| -rw-r--r-- | js/transition.js | 4 |
13 files changed, 48 insertions, 36 deletions
diff --git a/js/affix.js b/js/affix.js index a75a46db0..7d111ecc4 100644 --- a/js/affix.js +++ b/js/affix.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: affix.js v3.0.0 + * Bootstrap: affix.js v3.0.2 * http://getbootstrap.com/javascript/#affix * ======================================================================== * Copyright 2013 Twitter, Inc. @@ -123,4 +123,4 @@ }) }) -}(window.jQuery); +}(jQuery); diff --git a/js/alert.js b/js/alert.js index 73372e4f1..031d72aa5 100644 --- a/js/alert.js +++ b/js/alert.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: alert.js v3.0.0 + * Bootstrap: alert.js v3.0.2 * http://getbootstrap.com/javascript/#alerts * ======================================================================== * Copyright 2013 Twitter, Inc. @@ -95,4 +95,4 @@ $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) -}(window.jQuery); +}(jQuery); diff --git a/js/button.js b/js/button.js index 44c101a2a..3c1613506 100644 --- a/js/button.js +++ b/js/button.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: button.js v3.0.0 + * Bootstrap: button.js v3.0.2 * http://getbootstrap.com/javascript/#buttons * ======================================================================== * Copyright 2013 Twitter, Inc. @@ -54,15 +54,21 @@ Button.prototype.toggle = function () { var $parent = this.$element.closest('[data-toggle="buttons"]') + var changed = true if ($parent.length) { var $input = this.$element.find('input') - .prop('checked', !this.$element.hasClass('active')) - .trigger('change') - if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active') + if ($input.prop('type') === 'radio') { + // see if clicking on current one + if ($input.prop('checked') && this.$element.hasClass('active')) + changed = false + else + $parent.find('.active').removeClass('active') + } + if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change') } - this.$element.toggleClass('active') + if (changed) this.$element.toggleClass('active') } @@ -106,4 +112,4 @@ e.preventDefault() }) -}(window.jQuery); +}(jQuery); diff --git a/js/carousel.js b/js/carousel.js index cf7baf2a7..a31bb071f 100644 --- a/js/carousel.js +++ b/js/carousel.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: carousel.js v3.0.0 + * Bootstrap: carousel.js v3.0.2 * http://getbootstrap.com/javascript/#carousel * ======================================================================== * Copyright 2013 Twitter, Inc. @@ -69,7 +69,7 @@ if (pos > (this.$items.length - 1) || pos < 0) return - if (this.sliding) return this.$element.one('slid', function () { that.to(pos) }) + if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) if (activeIndex == pos) return this.pause().cycle() return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) @@ -121,7 +121,7 @@ if (this.$indicators.length) { this.$indicators.find('.active').removeClass('active') - this.$element.one('slid', function () { + this.$element.one('slid.bs.carousel', function () { var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()]) $nextIndicator && $nextIndicator.addClass('active') }) @@ -139,7 +139,7 @@ $next.removeClass([type, direction].join(' ')).addClass('active') $active.removeClass(['active', direction].join(' ')) that.sliding = false - setTimeout(function () { that.$element.trigger('slid') }, 0) + setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0) }) .emulateTransitionEnd(600) } else { @@ -148,7 +148,7 @@ $active.removeClass('active') $next.addClass('active') this.sliding = false - this.$element.trigger('slid') + this.$element.trigger('slid.bs.carousel') } isCycling && this.cycle() @@ -214,4 +214,4 @@ }) }) -}(window.jQuery); +}(jQuery); diff --git a/js/collapse.js b/js/collapse.js index beb047725..9967b167f 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: collapse.js v3.0.0 + * Bootstrap: collapse.js v3.0.2 * http://getbootstrap.com/javascript/#collapse * ======================================================================== * Copyright 2013 Twitter, Inc. @@ -176,4 +176,4 @@ $target.collapse(option) }) -}(window.jQuery); +}(jQuery); diff --git a/js/dropdown.js b/js/dropdown.js index e45d51c2d..147fcd7b0 100644 --- a/js/dropdown.js +++ b/js/dropdown.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: dropdown.js v3.0.0 + * Bootstrap: dropdown.js v3.0.2 * http://getbootstrap.com/javascript/#dropdowns * ======================================================================== * Copyright 2013 Twitter, Inc. @@ -41,7 +41,7 @@ if (!isActive) { if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { - // if mobile we we use a backdrop because click events don't delegate + // if mobile we use a backdrop because click events don't delegate $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus) } @@ -123,9 +123,9 @@ $.fn.dropdown = function (option) { return this.each(function () { var $this = $(this) - var data = $this.data('dropdown') + var data = $this.data('bs.dropdown') - if (!data) $this.data('dropdown', (data = new Dropdown(this))) + if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) if (typeof option == 'string') data[option].call($this) }) } @@ -151,4 +151,4 @@ .on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle) .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) -}(window.jQuery); +}(jQuery); diff --git a/js/modal.js b/js/modal.js index b5b56016c..dac50c6c6 100644 --- a/js/modal.js +++ b/js/modal.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: modal.js v3.0.0 + * Bootstrap: modal.js v3.0.2 * http://getbootstrap.com/javascript/#modals * ======================================================================== * Copyright 2013 Twitter, Inc. @@ -243,4 +243,4 @@ .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') }) .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') }) -}(window.jQuery); +}(jQuery); diff --git a/js/popover.js b/js/popover.js index d5cd02e59..35b488550 100644 --- a/js/popover.js +++ b/js/popover.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: popover.js v3.0.0 + * Bootstrap: popover.js v3.0.2 * http://getbootstrap.com/javascript/#popovers * ======================================================================== * Copyright 2013 Twitter, Inc. @@ -114,4 +114,4 @@ return this } -}(window.jQuery); +}(jQuery); diff --git a/js/scrollspy.js b/js/scrollspy.js index c88eaad99..b11ecdf29 100644 --- a/js/scrollspy.js +++ b/js/scrollspy.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: scrollspy.js v3.0.0 + * Bootstrap: scrollspy.js v3.0.2 * http://getbootstrap.com/javascript/#scrollspy * ======================================================================== * Copyright 2013 Twitter, Inc. @@ -113,7 +113,7 @@ .addClass('active') } - active.trigger('activate') + active.trigger('activate.bs.scrollspy') } @@ -155,4 +155,4 @@ }) }) -}(window.jQuery); +}(jQuery); @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: tab.js v3.0.0 + * Bootstrap: tab.js v3.0.2 * http://getbootstrap.com/javascript/#tabs * ======================================================================== * Copyright 2013 Twitter, Inc. @@ -132,4 +132,4 @@ $(this).tab('show') }) -}(window.jQuery); +}(jQuery); diff --git a/js/tests/unit/button.js b/js/tests/unit/button.js index 16284e0ce..115edefaf 100644 --- a/js/tests/unit/button.js +++ b/js/tests/unit/button.js @@ -111,6 +111,12 @@ $(function () { ok(!btn1.find('input').prop('checked'), 'btn1 is checked') ok(btn2.hasClass('active'), 'btn2 has active class') ok(btn2.find('input').prop('checked'), 'btn2 is checked') + + btn2.find('input').click() /* clicking an already checked radio should not un-check it */ + ok(!btn1.hasClass('active'), 'btn1 does not have active class') + ok(!btn1.find('input').prop('checked'), 'btn1 is checked') + ok(btn2.hasClass('active'), 'btn2 has active class') + ok(btn2.find('input').prop('checked'), 'btn2 is checked') }) }) diff --git a/js/tooltip.js b/js/tooltip.js index 41375c6c9..9e6177554 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: tooltip.js v3.0.0 + * Bootstrap: tooltip.js v3.0.2 * http://getbootstrap.com/javascript/#tooltip * Inspired by the original jQuery.tipsy by Jason Frame * ======================================================================== @@ -383,4 +383,4 @@ return this } -}(window.jQuery); +}(jQuery); diff --git a/js/transition.js b/js/transition.js index d3a7abffb..a692dfda9 100644 --- a/js/transition.js +++ b/js/transition.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: transition.js v3.0.0 + * Bootstrap: transition.js v3.0.2 * http://getbootstrap.com/javascript/#transitions * ======================================================================== * Copyright 2013 Twitter, Inc. @@ -53,4 +53,4 @@ $.support.transition = transitionEnd() }) -}(window.jQuery); +}(jQuery); |
