Commit 21084192 authored by Mark Otto's avatar Mark Otto

Fixes #13079: Scope .open class in button variant mixin to immediate children

parent 0dfd7375
...@@ -3488,7 +3488,7 @@ fieldset[disabled] .btn { ...@@ -3488,7 +3488,7 @@ fieldset[disabled] .btn {
.btn-default:focus, .btn-default:focus,
.btn-default:active, .btn-default:active,
.btn-default.active, .btn-default.active,
.open .dropdown-toggle.btn-default { .open > .dropdown-toggle.btn-default {
color: #333; color: #333;
background-color: #e6e6e6; background-color: #e6e6e6;
border-color: #adadad; border-color: #adadad;
...@@ -3496,7 +3496,7 @@ fieldset[disabled] .btn { ...@@ -3496,7 +3496,7 @@ fieldset[disabled] .btn {
.btn-default:active, .btn-default:active,
.btn-default.active, .btn-default.active,
.open .dropdown-toggle.btn-default { .open > .dropdown-toggle.btn-default {
background-image: none; background-image: none;
} }
...@@ -3534,7 +3534,7 @@ fieldset[disabled] .btn-default.active { ...@@ -3534,7 +3534,7 @@ fieldset[disabled] .btn-default.active {
.btn-primary:focus, .btn-primary:focus,
.btn-primary:active, .btn-primary:active,
.btn-primary.active, .btn-primary.active,
.open .dropdown-toggle.btn-primary { .open > .dropdown-toggle.btn-primary {
color: #fff; color: #fff;
background-color: #3071a9; background-color: #3071a9;
border-color: #285e8e; border-color: #285e8e;
...@@ -3542,7 +3542,7 @@ fieldset[disabled] .btn-default.active { ...@@ -3542,7 +3542,7 @@ fieldset[disabled] .btn-default.active {
.btn-primary:active, .btn-primary:active,
.btn-primary.active, .btn-primary.active,
.open .dropdown-toggle.btn-primary { .open > .dropdown-toggle.btn-primary {
background-image: none; background-image: none;
} }
...@@ -3580,7 +3580,7 @@ fieldset[disabled] .btn-primary.active { ...@@ -3580,7 +3580,7 @@ fieldset[disabled] .btn-primary.active {
.btn-success:focus, .btn-success:focus,
.btn-success:active, .btn-success:active,
.btn-success.active, .btn-success.active,
.open .dropdown-toggle.btn-success { .open > .dropdown-toggle.btn-success {
color: #fff; color: #fff;
background-color: #449d44; background-color: #449d44;
border-color: #398439; border-color: #398439;
...@@ -3588,7 +3588,7 @@ fieldset[disabled] .btn-primary.active { ...@@ -3588,7 +3588,7 @@ fieldset[disabled] .btn-primary.active {
.btn-success:active, .btn-success:active,
.btn-success.active, .btn-success.active,
.open .dropdown-toggle.btn-success { .open > .dropdown-toggle.btn-success {
background-image: none; background-image: none;
} }
...@@ -3626,7 +3626,7 @@ fieldset[disabled] .btn-success.active { ...@@ -3626,7 +3626,7 @@ fieldset[disabled] .btn-success.active {
.btn-info:focus, .btn-info:focus,
.btn-info:active, .btn-info:active,
.btn-info.active, .btn-info.active,
.open .dropdown-toggle.btn-info { .open > .dropdown-toggle.btn-info {
color: #fff; color: #fff;
background-color: #31b0d5; background-color: #31b0d5;
border-color: #269abc; border-color: #269abc;
...@@ -3634,7 +3634,7 @@ fieldset[disabled] .btn-success.active { ...@@ -3634,7 +3634,7 @@ fieldset[disabled] .btn-success.active {
.btn-info:active, .btn-info:active,
.btn-info.active, .btn-info.active,
.open .dropdown-toggle.btn-info { .open > .dropdown-toggle.btn-info {
background-image: none; background-image: none;
} }
...@@ -3672,7 +3672,7 @@ fieldset[disabled] .btn-info.active { ...@@ -3672,7 +3672,7 @@ fieldset[disabled] .btn-info.active {
.btn-warning:focus, .btn-warning:focus,
.btn-warning:active, .btn-warning:active,
.btn-warning.active, .btn-warning.active,
.open .dropdown-toggle.btn-warning { .open > .dropdown-toggle.btn-warning {
color: #fff; color: #fff;
background-color: #ec971f; background-color: #ec971f;
border-color: #d58512; border-color: #d58512;
...@@ -3680,7 +3680,7 @@ fieldset[disabled] .btn-info.active { ...@@ -3680,7 +3680,7 @@ fieldset[disabled] .btn-info.active {
.btn-warning:active, .btn-warning:active,
.btn-warning.active, .btn-warning.active,
.open .dropdown-toggle.btn-warning { .open > .dropdown-toggle.btn-warning {
background-image: none; background-image: none;
} }
...@@ -3718,7 +3718,7 @@ fieldset[disabled] .btn-warning.active { ...@@ -3718,7 +3718,7 @@ fieldset[disabled] .btn-warning.active {
.btn-danger:focus, .btn-danger:focus,
.btn-danger:active, .btn-danger:active,
.btn-danger.active, .btn-danger.active,
.open .dropdown-toggle.btn-danger { .open > .dropdown-toggle.btn-danger {
color: #fff; color: #fff;
background-color: #c9302c; background-color: #c9302c;
border-color: #ac2925; border-color: #ac2925;
...@@ -3726,7 +3726,7 @@ fieldset[disabled] .btn-warning.active { ...@@ -3726,7 +3726,7 @@ fieldset[disabled] .btn-warning.active {
.btn-danger:active, .btn-danger:active,
.btn-danger.active, .btn-danger.active,
.open .dropdown-toggle.btn-danger { .open > .dropdown-toggle.btn-danger {
background-image: none; background-image: none;
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2721,14 +2721,14 @@ fieldset[disabled] .btn { ...@@ -2721,14 +2721,14 @@ fieldset[disabled] .btn {
.btn-default:focus, .btn-default:focus,
.btn-default:active, .btn-default:active,
.btn-default.active, .btn-default.active,
.open .dropdown-toggle.btn-default { .open > .dropdown-toggle.btn-default {
color: #333; color: #333;
background-color: #e6e6e6; background-color: #e6e6e6;
border-color: #adadad; border-color: #adadad;
} }
.btn-default:active, .btn-default:active,
.btn-default.active, .btn-default.active,
.open .dropdown-toggle.btn-default { .open > .dropdown-toggle.btn-default {
background-image: none; background-image: none;
} }
.btn-default.disabled, .btn-default.disabled,
...@@ -2762,14 +2762,14 @@ fieldset[disabled] .btn-default.active { ...@@ -2762,14 +2762,14 @@ fieldset[disabled] .btn-default.active {
.btn-primary:focus, .btn-primary:focus,
.btn-primary:active, .btn-primary:active,
.btn-primary.active, .btn-primary.active,
.open .dropdown-toggle.btn-primary { .open > .dropdown-toggle.btn-primary {
color: #fff; color: #fff;
background-color: #3071a9; background-color: #3071a9;
border-color: #285e8e; border-color: #285e8e;
} }
.btn-primary:active, .btn-primary:active,
.btn-primary.active, .btn-primary.active,
.open .dropdown-toggle.btn-primary { .open > .dropdown-toggle.btn-primary {
background-image: none; background-image: none;
} }
.btn-primary.disabled, .btn-primary.disabled,
...@@ -2803,14 +2803,14 @@ fieldset[disabled] .btn-primary.active { ...@@ -2803,14 +2803,14 @@ fieldset[disabled] .btn-primary.active {
.btn-success:focus, .btn-success:focus,
.btn-success:active, .btn-success:active,
.btn-success.active, .btn-success.active,
.open .dropdown-toggle.btn-success { .open > .dropdown-toggle.btn-success {
color: #fff; color: #fff;
background-color: #449d44; background-color: #449d44;
border-color: #398439; border-color: #398439;
} }
.btn-success:active, .btn-success:active,
.btn-success.active, .btn-success.active,
.open .dropdown-toggle.btn-success { .open > .dropdown-toggle.btn-success {
background-image: none; background-image: none;
} }
.btn-success.disabled, .btn-success.disabled,
...@@ -2844,14 +2844,14 @@ fieldset[disabled] .btn-success.active { ...@@ -2844,14 +2844,14 @@ fieldset[disabled] .btn-success.active {
.btn-info:focus, .btn-info:focus,
.btn-info:active, .btn-info:active,
.btn-info.active, .btn-info.active,
.open .dropdown-toggle.btn-info { .open > .dropdown-toggle.btn-info {
color: #fff; color: #fff;
background-color: #31b0d5; background-color: #31b0d5;
border-color: #269abc; border-color: #269abc;
} }
.btn-info:active, .btn-info:active,
.btn-info.active, .btn-info.active,
.open .dropdown-toggle.btn-info { .open > .dropdown-toggle.btn-info {
background-image: none; background-image: none;
} }
.btn-info.disabled, .btn-info.disabled,
...@@ -2885,14 +2885,14 @@ fieldset[disabled] .btn-info.active { ...@@ -2885,14 +2885,14 @@ fieldset[disabled] .btn-info.active {
.btn-warning:focus, .btn-warning:focus,
.btn-warning:active, .btn-warning:active,
.btn-warning.active, .btn-warning.active,
.open .dropdown-toggle.btn-warning { .open > .dropdown-toggle.btn-warning {
color: #fff; color: #fff;
background-color: #ec971f; background-color: #ec971f;
border-color: #d58512; border-color: #d58512;
} }
.btn-warning:active, .btn-warning:active,
.btn-warning.active, .btn-warning.active,
.open .dropdown-toggle.btn-warning { .open > .dropdown-toggle.btn-warning {
background-image: none; background-image: none;
} }
.btn-warning.disabled, .btn-warning.disabled,
...@@ -2926,14 +2926,14 @@ fieldset[disabled] .btn-warning.active { ...@@ -2926,14 +2926,14 @@ fieldset[disabled] .btn-warning.active {
.btn-danger:focus, .btn-danger:focus,
.btn-danger:active, .btn-danger:active,
.btn-danger.active, .btn-danger.active,
.open .dropdown-toggle.btn-danger { .open > .dropdown-toggle.btn-danger {
color: #fff; color: #fff;
background-color: #c9302c; background-color: #c9302c;
border-color: #ac2925; border-color: #ac2925;
} }
.btn-danger:active, .btn-danger:active,
.btn-danger.active, .btn-danger.active,
.open .dropdown-toggle.btn-danger { .open > .dropdown-toggle.btn-danger {
background-image: none; background-image: none;
} }
.btn-danger.disabled, .btn-danger.disabled,
......
This diff was suppressed by a .gitattributes entry.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -1082,14 +1082,19 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re ...@@ -1082,14 +1082,19 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
title: '', title: '',
delay: 0, delay: 0,
html: false, html: false,
container: false container: false,
viewport: {
selector: 'body',
padding: 0
}
} }
Tooltip.prototype.init = function (type, element, options) { Tooltip.prototype.init = function (type, element, options) {
this.enabled = true this.enabled = true
this.type = type this.type = type
this.$element = $(element) this.$element = $(element)
this.options = this.getOptions(options) this.options = this.getOptions(options)
this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
var triggers = this.options.trigger.split(' ') var triggers = this.options.trigger.split(' ')
...@@ -1205,18 +1210,14 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re ...@@ -1205,18 +1210,14 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var actualHeight = $tip[0].offsetHeight var actualHeight = $tip[0].offsetHeight
if (autoPlace) { if (autoPlace) {
var $parent = this.$element.parent()
var orgPlacement = placement var orgPlacement = placement
var docScroll = document.documentElement.scrollTop var $parent = this.$element.parent()
var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth() var parentDim = this.getPosition($parent)
var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left placement = placement == 'bottom' && pos.top + pos.height + actualHeight - parentDim.scroll > parentDim.height ? 'top' :
placement == 'top' && pos.top - parentDim.scroll - actualHeight < 0 ? 'bottom' :
placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' : placement == 'right' && pos.right + actualWidth > parentDim.width ? 'left' :
placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' : placement == 'left' && pos.left - actualWidth < parentDim.left ? 'right' :
placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
placement placement
$tip $tip
...@@ -1276,29 +1277,20 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re ...@@ -1276,29 +1277,20 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var actualHeight = $tip[0].offsetHeight var actualHeight = $tip[0].offsetHeight
if (placement == 'top' && actualHeight != height) { if (placement == 'top' && actualHeight != height) {
replace = true
offset.top = offset.top + height - actualHeight offset.top = offset.top + height - actualHeight
} }
if (/bottom|top/.test(placement)) { var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
var delta = 0
if (offset.left < 0) {
delta = offset.left * -2
offset.left = 0
$tip.offset(offset) if (delta.left) offset.left += delta.left
else offset.top += delta.top
actualWidth = $tip[0].offsetWidth var arrowDelta = delta.left ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
actualHeight = $tip[0].offsetHeight var arrowPosition = delta.left ? 'left' : 'top'
} var arrowOffsetPosition = delta.left ? 'offsetWidth' : 'offsetHeight'
this.replaceArrow(delta - width + actualWidth, actualWidth, 'left') $tip.offset(offset)
} else { this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], arrowPosition)
this.replaceArrow(actualHeight - height, actualHeight, 'top')
}
if (replace) $tip.offset(offset)
} }
Tooltip.prototype.replaceArrow = function (delta, dimension, position) { Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
...@@ -1351,12 +1343,15 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re ...@@ -1351,12 +1343,15 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
return this.getTitle() return this.getTitle()
} }
Tooltip.prototype.getPosition = function () { Tooltip.prototype.getPosition = function ($element) {
var el = this.$element[0] $element = $element || this.$element
return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : { var el = $element[0]
width: el.offsetWidth, var isBody = el.tagName == 'BODY'
height: el.offsetHeight return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, {
}, this.$element.offset()) scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(),
width: isBody ? $(window).width() : $element.outerWidth(),
height: isBody ? $(window).height() : $element.outerHeight()
}, isBody ? {top: 0, left: 0} : $element.offset())
} }
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
...@@ -1364,6 +1359,35 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re ...@@ -1364,6 +1359,35 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
placement == 'top' ? { top: pos.top - actualHeight, 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 == '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 } /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
}
Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
var delta = { top: 0, left: 0 }
if (!this.$viewport) return delta
var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
var viewportDimensions = this.getPosition(this.$viewport)
if (/right|left/.test(placement)) {
var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
if (topEdgeOffset < viewportDimensions.top) { // top overflow
delta.top = viewportDimensions.top - topEdgeOffset
} else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
}
} else {
var leftEdgeOffset = pos.left - viewportPadding
var rightEdgeOffset = pos.left + viewportPadding + actualWidth
if (leftEdgeOffset < viewportDimensions.left) { // left overflow
delta.left = viewportDimensions.left - leftEdgeOffset
} else if (rightEdgeOffset > viewportDimensions.width) { // right overflow
delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
}
}
return delta
} }
Tooltip.prototype.getTitle = function () { Tooltip.prototype.getTitle = function () {
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff was suppressed by a .gitattributes entry.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -12,14 +12,14 @@ ...@@ -12,14 +12,14 @@
&:focus, &:focus,
&:active, &:active,
&.active, &.active,
.open .dropdown-toggle& { .open > .dropdown-toggle& {
color: @color; color: @color;
background-color: darken(@background, 10%); background-color: darken(@background, 10%);
border-color: darken(@border, 12%); border-color: darken(@border, 12%);
} }
&:active, &:active,
&.active, &.active,
.open .dropdown-toggle& { .open > .dropdown-toggle& {
background-image: none; background-image: none;
} }
&.disabled, &.disabled,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment