From 700e742a9cfac5e90ff882a5437e95691b090de0 Mon Sep 17 00:00:00 2001 From: Jason Diamond Date: Sun, 4 Aug 2013 23:59:30 -0700 Subject: failing test for dot in data-parent --- js/tests/unit/collapse.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'js') diff --git a/js/tests/unit/collapse.js b/js/tests/unit/collapse.js index 73799c75d..11b2cf838 100644 --- a/js/tests/unit/collapse.js +++ b/js/tests/unit/collapse.js @@ -126,4 +126,39 @@ $(function () { target3.click() }) + test("should allow dots in data-parent", function () { + $.support.transition = false + stop() + + var accordion = $('
') + .appendTo($('#qunit-fixture')) + + var target1 = $('') + .appendTo(accordion.find('.accordion-group').eq(0)) + + var collapsible1 = $('
') + .appendTo(accordion.find('.accordion-group').eq(0)) + + var target2 = $('') + .appendTo(accordion.find('.accordion-group').eq(1)) + + var collapsible2 = $('
') + .appendTo(accordion.find('.accordion-group').eq(1)) + + var target3 = $('') + .appendTo(accordion.find('.accordion-group').eq(2)) + + var collapsible3 = $('
') + .appendTo(accordion.find('.accordion-group').eq(2)) + .on('show.bs.collapse', function () { + ok(target1.hasClass('collapsed')) + ok(target2.hasClass('collapsed')) + ok(!target3.hasClass('collapsed')) + + start() + }) + + target3.click() + }) + }) -- cgit v1.2.3 From fb57eda26857f1312e4415926135e675895b13e1 Mon Sep 17 00:00:00 2001 From: Jason Diamond Date: Sun, 4 Aug 2013 23:59:57 -0700 Subject: use quotes to allow dots in data-parent --- 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 ab575515d..b20022a2e 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -169,7 +169,7 @@ 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') } -- 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 --- js/tooltip.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/tooltip.js b/js/tooltip.js index 8f2beedce..cd4ee50ed 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -179,7 +179,7 @@ .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) @@ -292,7 +292,7 @@ }, 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 --- js/modal.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'js') diff --git a/js/modal.js b/js/modal.js index d53cc9eaf..89c705a38 100644 --- a/js/modal.js +++ b/js/modal.js @@ -38,13 +38,13 @@ , 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) @@ -73,13 +73,15 @@ 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) }) } @@ -192,15 +194,15 @@ 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) }) } @@ -223,12 +225,12 @@ 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 --- js/modal.js | 3 +- js/tests/unit/modal.js | 301 ++++++++++++++++++++++++++----------------------- 2 files changed, 163 insertions(+), 141 deletions(-) (limited to 'js') diff --git a/js/modal.js b/js/modal.js index 89c705a38..ff3de1d94 100644 --- a/js/modal.js +++ b/js/modal.js @@ -103,6 +103,7 @@ this.$element .removeClass('in') .attr('aria-hidden', true) + .off('click.dismiss.modal') $.support.transition && this.$element.hasClass('fade') ? this.$element @@ -155,7 +156,7 @@ this.$backdrop = $('