From ccd4c9d7b5f90cbbef7f2c9d6b9b3dec615185fc Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Wed, 31 Jul 2013 22:28:05 -0700 Subject: fixes #8864 --- dist/js/bootstrap.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'dist/js/bootstrap.js') diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index a200e1589..bda74821b 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -1313,6 +1313,8 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } var $tip = this.tip() var e = $.Event('hide.bs.' + this.type) + function complete() { $tip.detach() } + this.$element.trigger(e) if (e.isDefaultPrevented()) return @@ -1321,9 +1323,9 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } $.support.transition && this.$tip.hasClass('fade') ? $tip - .one($.support.transition.end, $tip.detach) + .one($.support.transition.end, complete) .emulateTransitionEnd(150) : - $tip.detach() + complete() this.$element.trigger('hidden.bs.' + this.type) -- cgit v1.2.3 From 34e5c7542be4bf4792d77294a839f95815825f35 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Fri, 2 Aug 2013 09:33:12 -0700 Subject: whitespace in js file? --- dist/js/bootstrap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dist/js/bootstrap.js') diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index bda74821b..51dc23904 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -533,7 +533,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return - var actives = this.$parent && this.$parent.find('> .accordion-group > .in') + var actives = this.$parent && this.$parent.find('> .accordion-group > .in') if (actives && actives.length) { var hasData = actives.data('bs.collapse') -- cgit v1.2.3 From f6cec812a6a0a4488fc675bbe7d02cfe7d1f7a2d Mon Sep 17 00:00:00 2001 From: fat Date: Fri, 2 Aug 2013 15:13:12 -0700 Subject: fixes #8957 --- dist/js/bootstrap.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'dist/js/bootstrap.js') diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index 51dc23904..6c560b292 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -219,7 +219,9 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } var $parent = this.$element.closest('[data-toggle="buttons"]') if ($parent.length) { - var $input = this.$element.find('input').prop('checked', !this.$element.hasClass('active')) + var $input = this.$element.find('input') + .prop('checked', !this.$element.hasClass('active')) + .trigger('change') if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active') } -- cgit v1.2.3 From 2b6ec389876fac116ae2a152e47be321632dd9ba Mon Sep 17 00:00:00 2001 From: fat Date: Sun, 4 Aug 2013 17:22:49 -0700 Subject: fixes #8880 --- dist/js/bootstrap.js | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'dist/js/bootstrap.js') diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index 6c560b292..dc6344d5a 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -1245,12 +1245,9 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } .addClass(placement) } - var tp = placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : - placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : - placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : - /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } + var calculatedOffset = this.getCalcuatedOffset(placement, pos, actualWidth, actualHeight) - this.applyPlacement(tp, placement) + this.applyPlacement(calculatedOffset, placement) this.$element.trigger('shown.bs.' + this.type) } } @@ -1262,25 +1259,33 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } var height = $tip[0].offsetHeight // manually read margins because getBoundingClientRect includes difference - offset.top = offset.top + parseInt($tip.css('margin-top'), 10) - offset.left = offset.left + parseInt($tip.css('margin-left'), 10) + var marginTop = parseInt($tip.css('margin-top'), 10) + var marginLeft = parseInt($tip.css('margin-left'), 10) + + // we must check for NaN for ie 8/9 + if (isNaN(marginTop)) marginTop = 0 + if (isNaN(marginLeft)) marginLeft = 0 + + offset.top = offset.top + marginTop + offset.left = offset.left + marginLeft $tip .offset(offset) .addClass('in') + // check to see if placing tip in new offset caused the tip to resize itself var actualWidth = $tip[0].offsetWidth var actualHeight = $tip[0].offsetHeight if (placement == 'top' && actualHeight != height) { replace = true - offset.top = offset.top + height - actualHeight + offset.top = offset.top + height - actualHeight } - if (placement == 'bottom' || placement == 'top') { + if (/bottom|top/.test(placement)) { var delta = 0 - if (offset.left < 0){ + if (offset.left < 0) { delta = offset.left * -2 offset.left = 0 @@ -1353,6 +1358,13 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } }, this.$element.offset()) } + Tooltip.prototype.getCalcuatedOffset = function (placement, pos, actualWidth, actualHeight) { + return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : + placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : + placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : + /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } + } + Tooltip.prototype.getTitle = function () { var title var $e = this.$element @@ -1368,8 +1380,8 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } return this.$tip = this.$tip || $(this.options.template) } - Tooltip.prototype.arrow =function(){ - return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow") + Tooltip.prototype.arrow =function () { + return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow') } Tooltip.prototype.validate = function () { @@ -1508,6 +1520,10 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } o.content) } + Popover.prototype.arrow =function () { + return this.$arrow = this.$arrow || this.tip().find('.arrow') + } + Popover.prototype.tip = function () { if (!this.$tip) this.$tip = $(this.options.template) return this.$tip -- cgit v1.2.3 From 300a9e7b5ac87aa95bf149e2e89ca66dbf1e531d Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sun, 4 Aug 2013 21:09:05 -0700 Subject: run grunt dist --- dist/js/bootstrap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dist/js/bootstrap.js') diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index dc6344d5a..29f4eea40 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -1380,7 +1380,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } return this.$tip = this.$tip || $(this.options.template) } - Tooltip.prototype.arrow =function () { + Tooltip.prototype.arrow = function () { return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow') } -- cgit v1.2.3 From f266595092cd43aead1f6617933554110aeb46ac Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Tue, 6 Aug 2013 11:18:12 -0700 Subject: Fixes #9150: Hide popover titles in IE8 Properly hides popover titles in IE8 because apparently it doesn't accept the `:empty` selector. /cc @fat @cvrebert --- dist/js/bootstrap.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'dist/js/bootstrap.js') diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index 29f4eea40..3ec3b8707 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -1503,7 +1503,13 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } $tip.removeClass('fade top bottom left right in') - $tip.find('.popover-title:empty').hide() + // Hide empty titles + // + // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do + // this manually by checking the contents. + if ($tip.find('.popover-title').html() === '') { + $tip.find('.popover-title').hide(); + } } Popover.prototype.hasContent = function () { -- cgit v1.2.3 From 06949d6a1801704282442696ec7f46c5c331918e Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Tue, 6 Aug 2013 14:57:14 -0700 Subject: grunt dist on spacing change --- dist/js/bootstrap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dist/js/bootstrap.js') diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index 3ec3b8707..65c36b055 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -1526,7 +1526,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } o.content) } - Popover.prototype.arrow =function () { + Popover.prototype.arrow = function () { return this.$arrow = this.$arrow || this.tip().find('.arrow') } -- cgit v1.2.3 From f86f6ee9555819468467d48387becf80c831d34f Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Thu, 8 Aug 2013 13:29:46 -0700 Subject: fix 'Calcuated' typo & run grunt; thanks @FagnerMartinsBrack fixes typo introduced in 2b6ec389876fac116ae2a152e47be321632dd9ba --- dist/js/bootstrap.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'dist/js/bootstrap.js') diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index 65c36b055..5bd8c5b84 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -656,7 +656,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } var $parent = parent && $(parent) if (!data || !data.transitioning) { - if ($parent) $parent.find('[data-toggle=collapse][data-parent=' + parent + ']').not($this).addClass('collapsed') + if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed') $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') } @@ -1245,7 +1245,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } .addClass(placement) } - var calculatedOffset = this.getCalcuatedOffset(placement, pos, actualWidth, actualHeight) + var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) this.applyPlacement(calculatedOffset, placement) this.$element.trigger('shown.bs.' + this.type) @@ -1358,7 +1358,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } }, this.$element.offset()) } - Tooltip.prototype.getCalcuatedOffset = function (placement, pos, actualWidth, actualHeight) { + Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : -- cgit v1.2.3 From dbed9da77403337235acb652c3128ebc84672d60 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Fri, 9 Aug 2013 00:16:47 -0700 Subject: fixes #6159 --- dist/js/bootstrap.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'dist/js/bootstrap.js') diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index 5bd8c5b84..b56349703 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -860,13 +860,13 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } , show: true } - Modal.prototype.toggle = function () { - return this[!this.isShown ? 'show' : 'hide']() + Modal.prototype.toggle = function (_relatedTarget) { + return this[!this.isShown ? 'show' : 'hide'](_relatedTarget) } - Modal.prototype.show = function () { + Modal.prototype.show = function (_relatedTarget) { var that = this - var e = $.Event('show.bs.modal') + var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) this.$element.trigger(e) @@ -895,13 +895,15 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } that.enforceFocus() + var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) + transition ? that.$element .one($.support.transition.end, function () { - that.$element.focus().trigger('shown.bs.modal') + that.$element.focus().trigger(e) }) .emulateTransitionEnd(300) : - that.$element.focus().trigger('shown.bs.modal') + that.$element.focus().trigger(e) }) } @@ -1014,15 +1016,15 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } var old = $.fn.modal - $.fn.modal = function (option) { + $.fn.modal = function (option, _relatedTarget) { return this.each(function () { var $this = $(this) var data = $this.data('bs.modal') var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) if (!data) $this.data('bs.modal', (data = new Modal(this, options))) - if (typeof option == 'string') data[option]() - else if (options.show) data.show() + if (typeof option == 'string') data[option](_relatedTarget) + else if (options.show) data.show(_relatedTarget) }) } @@ -1045,12 +1047,12 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } var $this = $(this) var href = $this.attr('href') var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 - var option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data()) + var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) e.preventDefault() $target - .modal(option) + .modal(option, this) .one('hide', function () { $this.is(':visible') && $this.focus() }) -- cgit v1.2.3 From a4f0e8d37ab109c3f4476877854d4aea149fb1f2 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sat, 10 Aug 2013 13:35:20 -0700 Subject: fixes #9111 --- dist/js/bootstrap.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'dist/js/bootstrap.js') diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index b56349703..7c163a6d7 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -925,6 +925,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } this.$element .removeClass('in') .attr('aria-hidden', true) + .off('click.dismiss.modal') $.support.transition && this.$element.hasClass('fade') ? this.$element @@ -977,7 +978,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } this.$backdrop = $('