diff options
| author | Mark Otto <[email protected]> | 2014-09-17 15:21:31 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2014-09-17 15:21:31 -0700 |
| commit | 9f2aeafe851bdca522b886c29afcece1ee0060e1 (patch) | |
| tree | be13d5ce0d68631543f28af8d9b444a7bd44917e /docs/dist/js/bootstrap.js | |
| parent | 7d9f55c3d5dcc5b12882af96245dab27be5fa346 (diff) | |
| parent | c5c67d0f54674dede58fc924d4d7c0f1d65705d9 (diff) | |
| download | bootstrap-9f2aeafe851bdca522b886c29afcece1ee0060e1.tar.xz bootstrap-9f2aeafe851bdca522b886c29afcece1ee0060e1.zip | |
Merge branch 'master' into derp
Conflicts:
Gruntfile.js
dist/css/bootstrap-theme.css.map
dist/css/bootstrap.css
dist/css/bootstrap.css.map
dist/css/bootstrap.min.css
dist/fonts/glyphicons-halflings-regular.svg
docs/_includes/components/badges.html
docs/_includes/components/input-groups.html
docs/_includes/components/pagination.html
docs/_includes/css/forms.html
docs/_includes/footer.html
docs/_includes/getting-started/browser-device-support.html
docs/_includes/getting-started/grunt.html
docs/_includes/home-nav.html
docs/_includes/js/alerts.html
docs/_includes/js/buttons.html
docs/_includes/js/carousel.html
docs/_includes/js/collapse.html
docs/_includes/js/modal.html
docs/_includes/js/popovers.html
docs/_includes/js/tooltips.html
docs/_includes/nav/getting-started.html
docs/_includes/nav/javascript.html
docs/assets/css/docs.min.css
docs/assets/css/src/docs.css
docs/assets/js/customize.min.js
docs/assets/js/raw-files.min.js
docs/browser-bugs.html
docs/dist/css/bootstrap-theme.css.map
docs/dist/css/bootstrap.css
docs/dist/css/bootstrap.css.map
docs/dist/css/bootstrap.min.css
docs/dist/fonts/glyphicons-halflings-regular.svg
fonts/glyphicons-halflings-regular.svg
less/_button-group.less
less/_jumbotron.less
less/_variables.less
less/mixins/vendor-prefixes.less
less/panels.less
less/thumbnails.less
package.json
Diffstat (limited to 'docs/dist/js/bootstrap.js')
| -rw-r--r-- | docs/dist/js/bootstrap.js | 77 |
1 files changed, 44 insertions, 33 deletions
diff --git a/docs/dist/js/bootstrap.js b/docs/dist/js/bootstrap.js index ed6a5d2af..652c26618 100644 --- a/docs/dist/js/bootstrap.js +++ b/docs/dist/js/bootstrap.js @@ -104,7 +104,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re if (e) e.preventDefault() if (!$parent.length) { - $parent = $this.hasClass('alert') ? $this : $this.parent() + $parent = $this.closest('.alert') } $parent.trigger(e = $.Event('close.bs.alert')) @@ -553,7 +553,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return - var actives = this.$parent && this.$parent.find('> .panel > .in') + var actives = this.$parent && this.$parent.find('> .panel').children('.in, .collapsing') if (actives && actives.length) { var hasData = actives.data('bs.collapse') @@ -567,6 +567,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re this.$element .removeClass('collapse') .addClass('collapsing')[dimension](0) + .attr('aria-expanded', true) this.transitioning = 1 @@ -602,15 +603,16 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re this.$element .addClass('collapsing') .removeClass('collapse in') + .attr('aria-expanded', false) this.transitioning = 1 var complete = function () { this.transitioning = 0 this.$element - .trigger('hidden.bs.collapse') .removeClass('collapsing') .addClass('collapse') + .trigger('hidden.bs.collapse') } if (!$.support.transition) return complete.call(this) @@ -635,7 +637,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re var data = $this.data('bs.collapse') var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) - if (!data && options.toggle && option == 'show') option = !option + if (!data && options.toggle && option == 'show') options.toggle = false if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) if (typeof option == 'string') data[option]() }) @@ -672,8 +674,9 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re var $parent = parent && $(parent) if (!data || !data.transitioning) { - if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') - $this.toggleClass('collapsed', $target.hasClass('in')) + if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed').attr('aria-expanded', false) + var isCollapsed = $target.hasClass('in') + $this.toggleClass('collapsed', isCollapsed).attr('aria-expanded', !isCollapsed) } Plugin.call($target, option) @@ -1012,7 +1015,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') .appendTo(this.$body) - this.$element.on('mousedown.dismiss.bs.modal', $.proxy(function (e) { + this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { if (e.target !== e.currentTarget) return this.options.backdrop == 'static' ? this.$element[0].focus.call(this.$element[0]) @@ -1050,8 +1053,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re } Modal.prototype.checkScrollbar = function () { - if (document.body.clientWidth >= window.innerWidth) return - this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar() + this.scrollbarWidth = this.measureScrollbar() } Modal.prototype.setScrollbar = function () { @@ -1064,6 +1066,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re } Modal.prototype.measureScrollbar = function () { // thx walsh + if (document.body.clientWidth >= window.innerWidth) return 0 var scrollDiv = document.createElement('div') scrollDiv.className = 'modal-scrollbar-measure' this.$body.append(scrollDiv) @@ -1232,6 +1235,11 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re var self = obj instanceof this.constructor ? obj : $(obj.currentTarget).data('bs.' + this.type) + if (self && self.$tip && self.$tip.is(':visible')) { + self.hoverState = 'in' + return + } + if (!self) { self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) $(obj.currentTarget).data('bs.' + this.type, self) @@ -1274,7 +1282,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re if (this.hasContent() && this.enabled) { this.$element.trigger(e) - var inDom = $.contains(document.documentElement, this.$element[0]) + var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) if (e.isDefaultPrevented() || !inDom) return var that = this @@ -1383,16 +1391,18 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re if (delta.left) offset.left += delta.left else offset.top += delta.top - var arrowDelta = delta.left ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight - var arrowPosition = delta.left ? 'left' : 'top' - var arrowOffsetPosition = delta.left ? 'offsetWidth' : 'offsetHeight' + var isVertical = /top|bottom/.test(placement) + var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight + var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' $tip.offset(offset) - this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], arrowPosition) + this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) } - Tooltip.prototype.replaceArrow = function (delta, dimension, position) { - this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '') + Tooltip.prototype.replaceArrow = function (delta, dimension, isHorizontal) { + this.arrow() + .css(isHorizontal ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') + .css(isHorizontal ? 'top' : 'left', '') } Tooltip.prototype.setContent = function () { @@ -1403,16 +1413,17 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re $tip.removeClass('fade in top bottom left right') } - Tooltip.prototype.hide = function () { + Tooltip.prototype.hide = function (callback) { var that = this var $tip = this.tip() var e = $.Event('hide.bs.' + this.type) - this.$element.removeAttr('aria-describedby') - function complete() { if (that.hoverState != 'in') $tip.detach() - that.$element.trigger('hidden.bs.' + that.type) + that.$element + .removeAttr('aria-describedby') + .trigger('hidden.bs.' + that.type) + callback && callback() } this.$element.trigger(e) @@ -1450,7 +1461,11 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re var isBody = el.tagName == 'BODY' var isSvg = window.SVGElement && el instanceof window.SVGElement - var elRect = el.getBoundingClientRect ? el.getBoundingClientRect() : null + var elRect = el.getBoundingClientRect() + if (elRect.width == null) { + // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 + elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) + } var elOffset = isBody ? { top: 0, left: 0 } : $element.offset() var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } var outerDims = isSvg ? {} : { @@ -1522,14 +1537,6 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) } - Tooltip.prototype.validate = function () { - if (!this.$element[0].parentNode) { - this.hide() - this.$element = null - this.options = null - } - } - Tooltip.prototype.enable = function () { this.enabled = true } @@ -1556,8 +1563,11 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re } Tooltip.prototype.destroy = function () { + var that = this clearTimeout(this.timeout) - this.hide().$element.off('.' + this.type).removeData('bs.' + this.type) + this.hide(function () { + that.$element.off('.' + that.type).removeData('bs.' + that.type) + }) } @@ -1640,7 +1650,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re var content = this.getContent() $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) - $tip.find('.popover-content').empty()[ // we use append for html objects to maintain js events + $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' ](content) @@ -1773,6 +1783,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re return ($href && $href.length && $href.is(':visible') + && $el.is(':visible') && [[$href[offsetMethod]().top + offsetBase, href]]) || null }) .sort(function (a, b) { return a[0] - b[0] }) @@ -2162,8 +2173,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re data.offset = data.offset || {} - if (data.offsetBottom) data.offset.bottom = data.offsetBottom - if (data.offsetTop) data.offset.top = data.offsetTop + if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom + if (data.offsetTop != null) data.offset.top = data.offsetTop Plugin.call($spy, data) }) |
