From 138af82e298fd57d2f992a39934067fc5bd99a91 Mon Sep 17 00:00:00 2001 From: Ashley Dawson Date: Wed, 26 Mar 2014 22:21:54 +0000 Subject: Fixed nested tab elements li activation Added closest li instead of direct parent so that you can nest multiple elements within tabs, such as button groups --- js/tab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/tab.js') diff --git a/js/tab.js b/js/tab.js index 400cb7b84..74e0a96e8 100644 --- a/js/tab.js +++ b/js/tab.js @@ -40,7 +40,7 @@ var $target = $(selector) - this.activate($this.parent('li'), $ul) + this.activate($this.closest('li'), $ul) this.activate($target, $target.parent(), function () { $this.trigger({ type: 'shown.bs.tab', -- cgit v1.2.3 From a9f2b6ce0fb2ac059e30da259f7ae25282803c09 Mon Sep 17 00:00:00 2001 From: Collin Donahue-Oponski Date: Mon, 21 Apr 2014 23:03:33 -0600 Subject: #11464 - Fix JS noConflict mode - Refactor all plugins to use an internal reference to the jQuery plugin, because in noConflict mode you can never expect to be defined on the jQuery object --- js/tab.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'js/tab.js') diff --git a/js/tab.js b/js/tab.js index 400cb7b84..43190294b 100644 --- a/js/tab.js +++ b/js/tab.js @@ -90,9 +90,7 @@ // TAB PLUGIN DEFINITION // ===================== - var old = $.fn.tab - - $.fn.tab = function ( option ) { + function Plugin( option ) { return this.each(function () { var $this = $(this) var data = $this.data('bs.tab') @@ -102,6 +100,9 @@ }) } + var old = $.fn.tab + + $.fn.tab = Plugin $.fn.tab.Constructor = Tab @@ -119,7 +120,7 @@ $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { e.preventDefault() - $(this).tab('show') + Plugin.call($(this), 'show') }) }(jQuery); -- cgit v1.2.3 From f219fee07b14ea1d37e197b1d80f5c7a8e3bc186 Mon Sep 17 00:00:00 2001 From: fat Date: Mon, 12 May 2014 21:15:16 -0700 Subject: versions --- js/tab.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/tab.js') diff --git a/js/tab.js b/js/tab.js index 5a6b6a331..0078453c5 100644 --- a/js/tab.js +++ b/js/tab.js @@ -17,6 +17,8 @@ this.element = $(element) } + Tab.VERSION = '3.1.1' + Tab.prototype.show = function () { var $this = this.element var $ul = $this.closest('ul:not(.dropdown-menu)') -- cgit v1.2.3 From 7b0acf14d8a7c7c6089035a848cba540ed963f36 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 17 Mar 2014 09:12:55 +0200 Subject: Comply to the new style. --- js/tab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/tab.js') diff --git a/js/tab.js b/js/tab.js index 0078453c5..51f5cbb68 100644 --- a/js/tab.js +++ b/js/tab.js @@ -92,7 +92,7 @@ // TAB PLUGIN DEFINITION // ===================== - function Plugin( option ) { + function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.tab') -- cgit v1.2.3 From 1c6fa9010daf0d0c21de9e20fe6ac4dba1788d90 Mon Sep 17 00:00:00 2001 From: Katie Zhu Date: Mon, 9 Jun 2014 22:18:05 -0700 Subject: MD/CommonJS/Globals #12909 --- js/tab.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'js/tab.js') diff --git a/js/tab.js b/js/tab.js index 51f5cbb68..57ae6bc9f 100644 --- a/js/tab.js +++ b/js/tab.js @@ -7,7 +7,11 @@ * ======================================================================== */ -+function ($) { +(function (o_o) { + typeof define === 'function' && define.amd ? define(['jquery'], o_o) : + typeof exports === 'object' ? o_o(require('jquery')) : o_o(this.jQuery) +})(function ($) { + 'use strict'; // TAB CLASS DEFINITION @@ -125,4 +129,4 @@ Plugin.call($(this), 'show') }) -}(jQuery); +}); -- cgit v1.2.3 From 7f122be0041ff2d4314a196d53d32dc5f295ed02 Mon Sep 17 00:00:00 2001 From: fat Date: Tue, 10 Jun 2014 19:56:08 -0700 Subject: add special transitionend type to test event origin fixes #13430 --- js/tab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/tab.js') diff --git a/js/tab.js b/js/tab.js index 57ae6bc9f..3eec7c2df 100644 --- a/js/tab.js +++ b/js/tab.js @@ -85,7 +85,7 @@ transition ? $active - .one($.support.transition.end, next) + .one('bsTransitionEnd', next) .emulateTransitionEnd(150) : next() -- cgit v1.2.3 From e9d6756a1ac76a9db31a41e8e03f663bedc41b70 Mon Sep 17 00:00:00 2001 From: Heinrich Fenkart Date: Thu, 12 Jun 2014 06:00:02 +0200 Subject: Fix regression of #10038 introduced by #13772 --- js/tab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/tab.js') diff --git a/js/tab.js b/js/tab.js index 57ae6bc9f..e9b96bf4b 100644 --- a/js/tab.js +++ b/js/tab.js @@ -9,7 +9,7 @@ (function (o_o) { typeof define === 'function' && define.amd ? define(['jquery'], o_o) : - typeof exports === 'object' ? o_o(require('jquery')) : o_o(this.jQuery) + typeof exports === 'object' ? o_o(require('jquery')) : o_o(jQuery) })(function ($) { 'use strict'; -- cgit v1.2.3 From 2b302f69eea416bc85e7827b7d7a74d49f879662 Mon Sep 17 00:00:00 2001 From: fat Date: Thu, 12 Jun 2014 11:11:04 -0700 Subject: some changes from #13801 - add strict mode back and == --- js/tab.js | 184 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 93 insertions(+), 91 deletions(-) (limited to 'js/tab.js') diff --git a/js/tab.js b/js/tab.js index 3c4f6f32d..c8122157f 100644 --- a/js/tab.js +++ b/js/tab.js @@ -7,126 +7,128 @@ * ======================================================================== */ -(function (o_o) { - typeof define === 'function' && define.amd ? define(['jquery'], o_o) : - typeof exports === 'object' ? o_o(require('jquery')) : o_o(jQuery) -})(function ($) { ++function () { 'use strict'; - 'use strict'; + (function (o_o) { + typeof define == 'function' && define.amd ? define(['jquery'], o_o) : + typeof exports == 'object' ? o_o(require('jquery')) : o_o(jQuery) + })(function ($) { - // TAB CLASS DEFINITION - // ==================== + // TAB CLASS DEFINITION + // ==================== - var Tab = function (element) { - this.element = $(element) - } + var Tab = function (element) { + this.element = $(element) + } - Tab.VERSION = '3.1.1' + Tab.VERSION = '3.1.1' - Tab.prototype.show = function () { - var $this = this.element - var $ul = $this.closest('ul:not(.dropdown-menu)') - var selector = $this.data('target') + Tab.prototype.show = function () { + var $this = this.element + var $ul = $this.closest('ul:not(.dropdown-menu)') + var selector = $this.data('target') - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 - } + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 + } - if ($this.parent('li').hasClass('active')) return + if ($this.parent('li').hasClass('active')) return - var previous = $ul.find('.active:last a')[0] - var e = $.Event('show.bs.tab', { - relatedTarget: previous - }) + var previous = $ul.find('.active:last a')[0] + var e = $.Event('show.bs.tab', { + relatedTarget: previous + }) - $this.trigger(e) + $this.trigger(e) - if (e.isDefaultPrevented()) return + if (e.isDefaultPrevented()) return - var $target = $(selector) + var $target = $(selector) - this.activate($this.closest('li'), $ul) - this.activate($target, $target.parent(), function () { - $this.trigger({ - type: 'shown.bs.tab', - relatedTarget: previous + this.activate($this.closest('li'), $ul) + this.activate($target, $target.parent(), function () { + $this.trigger({ + type: 'shown.bs.tab', + relatedTarget: previous + }) }) - }) - } - - Tab.prototype.activate = function (element, container, callback) { - var $active = container.find('> .active') - var transition = callback - && $.support.transition - && $active.hasClass('fade') - - function next() { - $active - .removeClass('active') - .find('> .dropdown-menu > .active') - .removeClass('active') - - element.addClass('active') - - if (transition) { - element[0].offsetWidth // reflow for transition - element.addClass('in') - } else { - element.removeClass('fade') - } + } + + Tab.prototype.activate = function (element, container, callback) { + var $active = container.find('> .active') + var transition = callback + && $.support.transition + && $active.hasClass('fade') - if (element.parent('.dropdown-menu')) { - element.closest('li.dropdown').addClass('active') + function next() { + $active + .removeClass('active') + .find('> .dropdown-menu > .active') + .removeClass('active') + + element.addClass('active') + + if (transition) { + element[0].offsetWidth // reflow for transition + element.addClass('in') + } else { + element.removeClass('fade') + } + + if (element.parent('.dropdown-menu')) { + element.closest('li.dropdown').addClass('active') + } + + callback && callback() } - callback && callback() - } + transition ? + $active + .one('bsTransitionEnd', next) + .emulateTransitionEnd(150) : + next() - transition ? - $active - .one('bsTransitionEnd', next) - .emulateTransitionEnd(150) : - next() + $active.removeClass('in') + } - $active.removeClass('in') - } + // TAB PLUGIN DEFINITION + // ===================== - // TAB PLUGIN DEFINITION - // ===================== + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.tab') - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.tab') + if (!data) $this.data('bs.tab', (data = new Tab(this))) + if (typeof option == 'string') data[option]() + }) + } - if (!data) $this.data('bs.tab', (data = new Tab(this))) - if (typeof option == 'string') data[option]() - }) - } + var old = $.fn.tab - var old = $.fn.tab + $.fn.tab = Plugin + $.fn.tab.Constructor = Tab - $.fn.tab = Plugin - $.fn.tab.Constructor = Tab + // TAB NO CONFLICT + // =============== - // TAB NO CONFLICT - // =============== + $.fn.tab.noConflict = function () { + $.fn.tab = old + return this + } - $.fn.tab.noConflict = function () { - $.fn.tab = old - return this - } + // TAB DATA-API + // ============ - // TAB DATA-API - // ============ + $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { + e.preventDefault() + Plugin.call($(this), 'show') + }) - $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { - e.preventDefault() - Plugin.call($(this), 'show') }) -}); +}(); -- cgit v1.2.3 From 587451ad9a2b288ed54857c6ac291609a6394c6f Mon Sep 17 00:00:00 2001 From: Heinrich Fenkart Date: Thu, 19 Jun 2014 11:41:23 +0200 Subject: Update a few source files to comply to new JSCS rules --- js/tab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/tab.js') diff --git a/js/tab.js b/js/tab.js index c8122157f..de93ec83f 100644 --- a/js/tab.js +++ b/js/tab.js @@ -30,7 +30,7 @@ if (!selector) { selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 } if ($this.parent('li').hasClass('active')) return -- cgit v1.2.3 From c2c19a4d2d45d8ccb5c84d293dea35a94148c9a4 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Mon, 23 Jun 2014 11:07:18 -0700 Subject: Revert UMD (#13772 & friends) for now, due to #13812. Will hopefully revert this reversion and land a fully-working version of UMD in v3.3.0. Revert "some changes from #13801 - add strict mode back and ==" This reverts commit 2b302f69eea416bc85e7827b7d7a74d49f879662. Revert "Fix regression of #10038 introduced by #13772" This reverts commit e9d6756a1ac76a9db31a41e8e03f663bedc41b70. Revert "MD/CommonJS/Globals #12909" This reverts commit 1c6fa9010daf0d0c21de9e20fe6ac4dba1788d90. Revert "address #13811" This reverts commit f347d7d955bbb17234b8e12c68efae7d516ce62c. Conflicts: js/carousel.js js/collapse.js js/dropdown.js js/modal.js js/tab.js js/tooltip.js --- js/tab.js | 182 ++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 88 insertions(+), 94 deletions(-) (limited to 'js/tab.js') diff --git a/js/tab.js b/js/tab.js index de93ec83f..8e922ddcb 100644 --- a/js/tab.js +++ b/js/tab.js @@ -7,128 +7,122 @@ * ======================================================================== */ -+function () { 'use strict'; ++function ($) { + 'use strict'; - (function (o_o) { - typeof define == 'function' && define.amd ? define(['jquery'], o_o) : - typeof exports == 'object' ? o_o(require('jquery')) : o_o(jQuery) - })(function ($) { + // TAB CLASS DEFINITION + // ==================== - // TAB CLASS DEFINITION - // ==================== + var Tab = function (element) { + this.element = $(element) + } - var Tab = function (element) { - this.element = $(element) - } - - Tab.VERSION = '3.1.1' - - Tab.prototype.show = function () { - var $this = this.element - var $ul = $this.closest('ul:not(.dropdown-menu)') - var selector = $this.data('target') - - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 - } - - if ($this.parent('li').hasClass('active')) return + Tab.VERSION = '3.1.1' - var previous = $ul.find('.active:last a')[0] - var e = $.Event('show.bs.tab', { - relatedTarget: previous - }) - - $this.trigger(e) + Tab.prototype.show = function () { + var $this = this.element + var $ul = $this.closest('ul:not(.dropdown-menu)') + var selector = $this.data('target') - if (e.isDefaultPrevented()) return - - var $target = $(selector) - - this.activate($this.closest('li'), $ul) - this.activate($target, $target.parent(), function () { - $this.trigger({ - type: 'shown.bs.tab', - relatedTarget: previous - }) - }) + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 } - Tab.prototype.activate = function (element, container, callback) { - var $active = container.find('> .active') - var transition = callback - && $.support.transition - && $active.hasClass('fade') + if ($this.parent('li').hasClass('active')) return - function next() { - $active - .removeClass('active') - .find('> .dropdown-menu > .active') - .removeClass('active') + var previous = $ul.find('.active:last a')[0] + var e = $.Event('show.bs.tab', { + relatedTarget: previous + }) - element.addClass('active') + $this.trigger(e) - if (transition) { - element[0].offsetWidth // reflow for transition - element.addClass('in') - } else { - element.removeClass('fade') - } + if (e.isDefaultPrevented()) return - if (element.parent('.dropdown-menu')) { - element.closest('li.dropdown').addClass('active') - } + var $target = $(selector) - callback && callback() + this.activate($this.closest('li'), $ul) + this.activate($target, $target.parent(), function () { + $this.trigger({ + type: 'shown.bs.tab', + relatedTarget: previous + }) + }) + } + + Tab.prototype.activate = function (element, container, callback) { + var $active = container.find('> .active') + var transition = callback + && $.support.transition + && $active.hasClass('fade') + + function next() { + $active + .removeClass('active') + .find('> .dropdown-menu > .active') + .removeClass('active') + + element.addClass('active') + + if (transition) { + element[0].offsetWidth // reflow for transition + element.addClass('in') + } else { + element.removeClass('fade') } - transition ? - $active - .one('bsTransitionEnd', next) - .emulateTransitionEnd(150) : - next() + if (element.parent('.dropdown-menu')) { + element.closest('li.dropdown').addClass('active') + } - $active.removeClass('in') + callback && callback() } + transition ? + $active + .one('bsTransitionEnd', next) + .emulateTransitionEnd(150) : + next() - // TAB PLUGIN DEFINITION - // ===================== + $active.removeClass('in') + } - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.tab') - if (!data) $this.data('bs.tab', (data = new Tab(this))) - if (typeof option == 'string') data[option]() - }) - } + // TAB PLUGIN DEFINITION + // ===================== - var old = $.fn.tab + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.tab') - $.fn.tab = Plugin - $.fn.tab.Constructor = Tab + if (!data) $this.data('bs.tab', (data = new Tab(this))) + if (typeof option == 'string') data[option]() + }) + } + var old = $.fn.tab - // TAB NO CONFLICT - // =============== + $.fn.tab = Plugin + $.fn.tab.Constructor = Tab - $.fn.tab.noConflict = function () { - $.fn.tab = old - return this - } + // TAB NO CONFLICT + // =============== - // TAB DATA-API - // ============ + $.fn.tab.noConflict = function () { + $.fn.tab = old + return this + } - $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { - e.preventDefault() - Plugin.call($(this), 'show') - }) + // TAB DATA-API + // ============ + + $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { + e.preventDefault() + Plugin.call($(this), 'show') }) -}(); +}(jQuery); -- cgit v1.2.3 From 634ea59a259c8d3e4dc164528f984758eebd8883 Mon Sep 17 00:00:00 2001 From: Heinrich Fenkart Date: Fri, 13 Jun 2014 14:06:55 +0200 Subject: Allow tabs to fade in if no initially active pane is present; fixes #13814 --- js/tab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/tab.js') diff --git a/js/tab.js b/js/tab.js index 8e922ddcb..c46f5182b 100644 --- a/js/tab.js +++ b/js/tab.js @@ -55,7 +55,7 @@ var $active = container.find('> .active') var transition = callback && $.support.transition - && $active.hasClass('fade') + && (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length) function next() { $active @@ -79,7 +79,7 @@ callback && callback() } - transition ? + $active.length && transition ? $active .one('bsTransitionEnd', next) .emulateTransitionEnd(150) : -- cgit v1.2.3 From ff6b279b3cd37e7e4e6bd93535afd016f6957afc Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Thu, 26 Jun 2014 09:13:24 -0700 Subject: bump to v3.2.0 --- js/tab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/tab.js') diff --git a/js/tab.js b/js/tab.js index 8e922ddcb..c0e1e466c 100644 --- a/js/tab.js +++ b/js/tab.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: tab.js v3.1.1 + * Bootstrap: tab.js v3.2.0 * http://getbootstrap.com/javascript/#tabs * ======================================================================== * Copyright 2011-2014 Twitter, Inc. @@ -17,7 +17,7 @@ this.element = $(element) } - Tab.VERSION = '3.1.1' + Tab.VERSION = '3.2.0' Tab.prototype.show = function () { var $this = this.element -- cgit v1.2.3