diff options
author | Gleb Mazovetskiy <glex.spb@gmail.com> | 2014-09-10 20:55:42 +0400 |
---|---|---|
committer | Gleb Mazovetskiy <glex.spb@gmail.com> | 2014-09-10 20:55:42 +0400 |
commit | 13c00527034691c45397fb8653b8a4c741aa0cd4 (patch) | |
tree | 28fb116683bce444ab19e2418eecc00ed66cddf8 /assets/javascripts/bootstrap.js | |
parent | fe4aaa4b8a98e8b2f32f2d2e7f1c616d68417087 (diff) |
rake convert
Diffstat (limited to 'assets/javascripts/bootstrap.js')
-rw-r--r-- | assets/javascripts/bootstrap.js | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/assets/javascripts/bootstrap.js b/assets/javascripts/bootstrap.js index 637ff16f..07c8c193 100644 --- a/assets/javascripts/bootstrap.js +++ b/assets/javascripts/bootstrap.js @@ -152,8 +152,8 @@ 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) }) @@ -662,6 +662,7 @@ this.$element .removeClass('collapse') .addClass('collapsing')[dimension](0) + .attr('aria-expanded', true) this.transitioning = 1 @@ -697,15 +698,16 @@ 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) @@ -767,8 +769,9 @@ 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) @@ -1469,7 +1472,7 @@ 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]) @@ -1507,8 +1510,7 @@ } 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 () { @@ -1521,6 +1523,7 @@ } 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) @@ -1689,6 +1692,11 @@ 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) @@ -1731,7 +1739,7 @@ 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 @@ -1865,11 +1873,11 @@ 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) } this.$element.trigger(e) |