From ccd4c9d7b5f90cbbef7f2c9d6b9b3dec615185fc Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Wed, 31 Jul 2013 22:28:05 -0700 Subject: fixes #8864 --- js/tooltip.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/tooltip.js b/js/tooltip.js index a954923be..30e3ae140 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -249,6 +249,8 @@ var $tip = this.tip() var e = $.Event('hide.bs.' + this.type) + function complete() { $tip.detach() } + this.$element.trigger(e) if (e.isDefaultPrevented()) return @@ -257,9 +259,9 @@ $.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 7a3c61ee33b8a07de20b2d30ed2bcd5fd7649fd6 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Wed, 31 Jul 2013 22:57:00 -0700 Subject: fixes #8892 --- js/collapse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/collapse.js b/js/collapse.js index 34ac3c7fa..ab575515d 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -48,7 +48,7 @@ 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 --- js/button.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/button.js b/js/button.js index ae5602fc2..fc73b555f 100644 --- a/js/button.js +++ b/js/button.js @@ -56,7 +56,9 @@ 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 --- js/popover.js | 4 ++++ js/tooltip.js | 36 ++++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 12 deletions(-) (limited to 'js') diff --git a/js/popover.js b/js/popover.js index b5888b6e4..feee3308d 100644 --- a/js/popover.js +++ b/js/popover.js @@ -75,6 +75,10 @@ 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 diff --git a/js/tooltip.js b/js/tooltip.js index 30e3ae140..3f9df0340 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -179,12 +179,9 @@ .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) } } @@ -196,25 +193,33 @@ 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 @@ -287,6 +292,13 @@ }, 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 @@ -302,8 +314,8 @@ 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 () { -- cgit v1.2.3 From 180034a4b450fb4a6567d6dbaaeb680905d798c4 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Sun, 4 Aug 2013 17:36:08 -0700 Subject: tooltip.js: add missing space --- js/tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/tooltip.js b/js/tooltip.js index 3f9df0340..8f2beedce 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -314,7 +314,7 @@ 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 --- js/popover.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/popover.js b/js/popover.js index feee3308d..4d4979247 100644 --- a/js/popover.js +++ b/js/popover.js @@ -58,7 +58,13 @@ $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 f816a18f7980d22de07f6e341551af68c3ba7958 Mon Sep 17 00:00:00 2001 From: Braden Whitten Date: Tue, 6 Aug 2013 17:02:57 -0400 Subject: Fix spacing after '=' Just added a space after a function definition to tidy up the code. --- js/popover.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/popover.js b/js/popover.js index 4d4979247..24b85715f 100644 --- a/js/popover.js +++ b/js/popover.js @@ -81,7 +81,7 @@ o.content) } - Popover.prototype.arrow =function () { + Popover.prototype.arrow = function () { return this.$arrow = this.$arrow || this.tip().find('.arrow') } -- cgit v1.2.3