1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-25 12:59:05 +02:00

some changes from #13801 - add strict mode back and ==

This commit is contained in:
fat
2014-06-12 11:11:04 -07:00
parent 696632d7da
commit 2b302f69ee
13 changed files with 1763 additions and 1738 deletions

View File

@@ -7,90 +7,92 @@
* ======================================================================== */
(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 ($) {
// ALERT CLASS DEFINITION
// ======================
// ALERT CLASS DEFINITION
// ======================
var dismiss = '[data-dismiss="alert"]'
var Alert = function (el) {
$(el).on('click', dismiss, this.close)
}
Alert.VERSION = '3.1.1'
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 dismiss = '[data-dismiss="alert"]'
var Alert = function (el) {
$(el).on('click', dismiss, this.close)
}
var $parent = $(selector)
Alert.VERSION = '3.1.1'
if (e) e.preventDefault()
Alert.prototype.close = function (e) {
var $this = $(this)
var selector = $this.attr('data-target')
if (!$parent.length) {
$parent = $this.hasClass('alert') ? $this : $this.parent()
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = $(selector)
if (e) e.preventDefault()
if (!$parent.length) {
$parent = $this.hasClass('alert') ? $this : $this.parent()
}
$parent.trigger(e = $.Event('close.bs.alert'))
if (e.isDefaultPrevented()) return
$parent.removeClass('in')
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()
}
$parent.trigger(e = $.Event('close.bs.alert'))
if (e.isDefaultPrevented()) return
// ALERT PLUGIN DEFINITION
// =======================
$parent.removeClass('in')
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.alert')
function removeElement() {
// detach from parent, fire event then clean up data
$parent.detach().trigger('closed.bs.alert').remove()
if (!data) $this.data('bs.alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
})
}
$.support.transition && $parent.hasClass('fade') ?
$parent
.one('bsTransitionEnd', removeElement)
.emulateTransitionEnd(150) :
removeElement()
}
var old = $.fn.alert
$.fn.alert = Plugin
$.fn.alert.Constructor = Alert
// ALERT PLUGIN DEFINITION
// =======================
// ALERT NO CONFLICT
// =================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.alert')
if (!data) $this.data('bs.alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
})
}
var old = $.fn.alert
$.fn.alert = Plugin
$.fn.alert.Constructor = Alert
$.fn.alert.noConflict = function () {
$.fn.alert = old
return this
}
// ALERT NO CONFLICT
// =================
// ALERT DATA-API
// ==============
$.fn.alert.noConflict = function () {
$.fn.alert = old
return this
}
$(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)
});
}();