diff options
| author | Chris Rebert <[email protected]> | 2014-06-23 11:07:18 -0700 |
|---|---|---|
| committer | Chris Rebert <[email protected]> | 2014-06-23 11:11:59 -0700 |
| commit | c2c19a4d2d45d8ccb5c84d293dea35a94148c9a4 (patch) | |
| tree | f12ed485a1a3f84ce60c6a195e8efca27f418042 /js/alert.js | |
| parent | bc895a4b43ecfd2ad8c3793fdd6d8bada9d93186 (diff) | |
| download | bootstrap-c2c19a4d2d45d8ccb5c84d293dea35a94148c9a4.tar.xz bootstrap-c2c19a4d2d45d8ccb5c84d293dea35a94148c9a4.zip | |
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
Diffstat (limited to 'js/alert.js')
| -rw-r--r-- | js/alert.js | 118 |
1 files changed, 56 insertions, 62 deletions
diff --git a/js/alert.js b/js/alert.js index f34f84a28..721e9aa47 100644 --- a/js/alert.js +++ b/js/alert.js @@ -7,92 +7,86 @@ * ======================================================================== */ -+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 ($) { + // ALERT CLASS DEFINITION + // ====================== - // ALERT CLASS DEFINITION - // ====================== + var dismiss = '[data-dismiss="alert"]' + var Alert = function (el) { + $(el).on('click', dismiss, this.close) + } - var dismiss = '[data-dismiss="alert"]' - var Alert = function (el) { - $(el).on('click', dismiss, this.close) - } - - Alert.VERSION = '3.1.1' + Alert.VERSION = '3.1.1' - Alert.prototype.close = function (e) { - var $this = $(this) - var selector = $this.attr('data-target') + Alert.prototype.close = function (e) { + var $this = $(this) + var selector = $this.attr('data-target') - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 - } - - var $parent = $(selector) + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 + } - if (e) e.preventDefault() + var $parent = $(selector) - if (!$parent.length) { - $parent = $this.hasClass('alert') ? $this : $this.parent() - } + if (e) e.preventDefault() - $parent.trigger(e = $.Event('close.bs.alert')) + if (!$parent.length) { + $parent = $this.hasClass('alert') ? $this : $this.parent() + } - if (e.isDefaultPrevented()) return + $parent.trigger(e = $.Event('close.bs.alert')) - $parent.removeClass('in') + if (e.isDefaultPrevented()) return - function removeElement() { - // detach from parent, fire event then clean up data - $parent.detach().trigger('closed.bs.alert').remove() - } + $parent.removeClass('in') - $.support.transition && $parent.hasClass('fade') ? - $parent - .one('bsTransitionEnd', removeElement) - .emulateTransitionEnd(150) : - removeElement() + function removeElement() { + // detach from parent, fire event then clean up data + $parent.detach().trigger('closed.bs.alert').remove() } + $.support.transition && $parent.hasClass('fade') ? + $parent + .one('bsTransitionEnd', removeElement) + .emulateTransitionEnd(150) : + removeElement() + } - // ALERT PLUGIN DEFINITION - // ======================= - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.alert') + // ALERT PLUGIN DEFINITION + // ======================= - if (!data) $this.data('bs.alert', (data = new Alert(this))) - if (typeof option == 'string') data[option].call($this) - }) - } + function Plugin(option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.alert') - var old = $.fn.alert + if (!data) $this.data('bs.alert', (data = new Alert(this))) + if (typeof option == 'string') data[option].call($this) + }) + } - $.fn.alert = Plugin - $.fn.alert.Constructor = Alert + var old = $.fn.alert + $.fn.alert = Plugin + $.fn.alert.Constructor = Alert - // ALERT NO CONFLICT - // ================= - $.fn.alert.noConflict = function () { - $.fn.alert = old - return this - } + // ALERT NO CONFLICT + // ================= + $.fn.alert.noConflict = function () { + $.fn.alert = old + return this + } - // ALERT DATA-API - // ============== - $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) + // ALERT DATA-API + // ============== - }) + $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) -}(); +}(jQuery); |
