Commit d1fbe200 authored by fat's avatar fat

remove closureness from plugins

parent 09fb8056
...@@ -108,80 +108,38 @@ module.exports = function (grunt) { ...@@ -108,80 +108,38 @@ module.exports = function (grunt) {
}, },
bootstrap: { bootstrap: {
src: [ src: [
'js/util.js', 'js/transition.js',
'js/alert.js', 'js/alert.js',
'js/button.js', 'js/button.js',
'js/carousel.js', 'js/carousel.js',
'js/collapse.js', 'js/collapse.js',
'js/dropdown.js', 'js/dropdown.js',
'js/modal.js', 'js/modal.js',
'js/scrollspy.js',
'js/tooltip.js', 'js/tooltip.js',
'js/popover.js', 'js/popover.js',
'js/tab.js' 'js/scrollspy.js',
'js/tab.js',
'js/affix.js'
], ],
dest: 'dist/js/<%= pkg.name %>.js' dest: 'dist/js/<%= pkg.name %>.js'
} }
}, },
closureCompiler: { uglify: {
options: { options: {
compilerFile: require('superstartup-closure-compiler').getPath(), compress: {
checkModified: false, warnings: false
compilerOpts: {
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
// jscomp_warning: 'reportUnknownTypes', someday - maybe we will get to 100% typed, this helps track those down
compilation_level: 'ADVANCED_OPTIMIZATIONS',
warning_level: 'verbose',
summary_detail_level: 3,
output_wrapper:
'"<%= banner %><%= jqueryCheck %><%= jqueryVersionCheck %>'
+ '(function($){%output%})(jQuery);"',
externs: 'js/externs/*.js'
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
}, },
mangle: true,
execOpts: { preserveComments: 'some'
maxBuffer: 999999 * 1024
},
// [OPTIONAL] Java VM optimization options
// see https://code.google.com/p/closure-compiler/wiki/FAQ#What_are_the_recommended_Java_VM_command-line_options?
// Setting one of these to 'true' is strongly recommended,
// and can reduce compile times by 50-80% depending on compilation size
// and hardware.
// On server-class hardware, such as with Github's Travis hook,
// TieredCompilation should be used; on standard developer hardware,
// d32 may be better. Set as appropriate for your environment.
// Default for both is 'false'; do not set both to 'true'.
d32: false, // will use 'java -client -d32 -jar compiler.jar'
TieredCompilation: false // will use 'java -server -XX:+TieredCompilation -jar compiler.jar'
}, },
core: {
targetName: { src: '<%= concat.bootstrap.dest %>',
src: [
'js/util.js',
'js/alert.js',
'js/button.js',
'js/carousel.js',
'js/collapse.js',
'js/dropdown.js',
'js/modal.js',
'js/scrollspy.js',
'js/tooltip.js',
'js/popover.js',
'js/tab.js'
],
dest: 'dist/js/<%= pkg.name %>.min.js' dest: 'dist/js/<%= pkg.name %>.min.js'
} },
customize: {
}, src: configBridge.paths.customizerJs,
dest: 'docs/assets/js/customize.min.js'
uglify: {
options: {
preserveComments: 'some'
}, },
docsJs: { docsJs: {
src: configBridge.paths.docsJs, src: configBridge.paths.docsJs,
...@@ -443,7 +401,7 @@ module.exports = function (grunt) { ...@@ -443,7 +401,7 @@ module.exports = function (grunt) {
grunt.registerTask('test-js', ['jshint:core', 'jshint:test', 'jshint:grunt', 'jscs:core', 'jscs:test', 'jscs:grunt', 'qunit']); grunt.registerTask('test-js', ['jshint:core', 'jshint:test', 'jshint:grunt', 'jscs:core', 'jscs:test', 'jscs:grunt', 'qunit']);
// JS distribution task. // JS distribution task.
grunt.registerTask('dist-js', ['concat', 'closureCompiler', 'commonjs']); grunt.registerTask('dist-js', ['concat', 'uglify:core', 'commonjs']);
grunt.registerTask('test-scss', ['scsslint:scss']); grunt.registerTask('test-scss', ['scsslint:scss']);
......
This diff is collapsed.
This diff is collapsed.
// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
require('../../js/util.js') require('../../js/transition.js')
require('../../js/alert.js') require('../../js/alert.js')
require('../../js/button.js') require('../../js/button.js')
require('../../js/carousel.js') require('../../js/carousel.js')
require('../../js/collapse.js') require('../../js/collapse.js')
require('../../js/dropdown.js') require('../../js/dropdown.js')
require('../../js/modal.js') require('../../js/modal.js')
require('../../js/scrollspy.js')
require('../../js/tooltip.js') require('../../js/tooltip.js')
require('../../js/popover.js') require('../../js/popover.js')
require('../../js/tab.js') require('../../js/scrollspy.js')
\ No newline at end of file require('../../js/tab.js')
require('../../js/affix.js')
\ No newline at end of file
'use strict'; 'use strict';
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
......
...@@ -17,8 +17,11 @@ ...@@ -17,8 +17,11 @@
"requireCamelCaseOrUpperCaseIdentifiers": true, "requireCamelCaseOrUpperCaseIdentifiers": true,
"requireCapitalizedConstructors": true, "requireCapitalizedConstructors": true,
"requireCommaBeforeLineBreak": true, "requireCommaBeforeLineBreak": true,
"requireDollarBeforejQueryAssignment": true,
"requireDotNotation": true, "requireDotNotation": true,
"requireLineFeedAtFileEnd": true, "requireLineFeedAtFileEnd": true,
"requirePaddingNewLinesAfterUseStrict": true,
"requirePaddingNewLinesBeforeExport": true,
"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="], "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"requireSpaceAfterLineComment": true, "requireSpaceAfterLineComment": true,
...@@ -31,7 +34,9 @@ ...@@ -31,7 +34,9 @@
"requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true }, "requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true },
"requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true },
"requireSpacesInsideObjectBrackets": "allButNested", "requireSpacesInsideObjectBrackets": "allButNested",
"validateAlignedFunctionParameters": true,
"validateIndentation": 2, "validateIndentation": 2,
"validateLineBreaks": "LF", "validateLineBreaks": "LF",
"validateNewlineAfterArrayElements": true,
"validateQuoteMarks": "'" "validateQuoteMarks": "'"
} }
/* ========================================================================
* Bootstrap: affix.js v3.3.4
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// AFFIX CLASS DEFINITION
// ======================
var Affix = function (element, options) {
this.options = $.extend({}, Affix.DEFAULTS, options)
this.$target = $(this.options.target)
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
this.$element = $(element)
this.affixed = null
this.unpin = null
this.pinnedOffset = null
this.checkPosition()
}
Affix.VERSION = '3.3.4'
Affix.RESET = 'affix affix-top affix-bottom'
Affix.DEFAULTS = {
offset: 0,
target: window
}
Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
var scrollTop = this.$target.scrollTop()
var position = this.$element.offset()
var targetHeight = this.$target.height()
if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
if (this.affixed == 'bottom') {
if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
}
var initializing = this.affixed == null
var colliderTop = initializing ? scrollTop : position.top
var colliderHeight = initializing ? targetHeight : height
if (offsetTop != null && scrollTop <= offsetTop) return 'top'
if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
return false
}
Affix.prototype.getPinnedOffset = function () {
if (this.pinnedOffset) return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix')
var scrollTop = this.$target.scrollTop()
var position = this.$element.offset()
return (this.pinnedOffset = position.top - scrollTop)
}
Affix.prototype.checkPositionWithEventLoop = function () {
setTimeout($.proxy(this.checkPosition, this), 1)
}
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return
var height = this.$element.height()
var offset = this.options.offset
var offsetTop = offset.top
var offsetBottom = offset.bottom
var scrollHeight = Math.max($(document).height(), $(document.body).height())
if (typeof offset != 'object') offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
if (this.affixed != affix) {
if (this.unpin != null) this.$element.css('top', '')
var affixType = 'affix' + (affix ? '-' + affix : '')
var e = $.Event(affixType + '.bs.affix')
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
this.affixed = affix
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
this.$element
.removeClass(Affix.RESET)
.addClass(affixType)
.trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
}
if (affix == 'bottom') {
this.$element.offset({
top: scrollHeight - height - offsetBottom
})
}
}
// AFFIX PLUGIN DEFINITION
// =======================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.affix')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.affix
$.fn.affix = Plugin
$.fn.affix.Constructor = Affix
// AFFIX NO CONFLICT
// =================
$.fn.affix.noConflict = function () {
$.fn.affix = old
return this
}
// AFFIX DATA-API
// ==============
$(window).on('load', function () {
$('[data-spy="affix"]').each(function () {
var $spy = $(this)
var data = $spy.data()
data.offset = data.offset || {}
if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
if (data.offsetTop != null) data.offset.top = data.offsetTop
Plugin.call($spy, data)
})
})
}(jQuery);
/** ======================================================================= /* ========================================================================
* Bootstrap: alert.js v4.0.0 * Bootstrap: alert.js v3.3.4
* http://getbootstrap.com/javascript/#alerts * http://getbootstrap.com/javascript/#alerts
* ======================================================================== * ========================================================================
* Copyright 2011-2015 Twitter, Inc. * Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== * ======================================================================== */
* @fileoverview - Bootstrap's generic alert component. Add dismiss
* functionality to all alert messages with this plugin.
*
* Public Methods & Properties:
*
* + $.alert
* + $.alert.noConflict
* + $.alert.Constructor
* + $.alert.Constructor.VERSION
* + $.alert.Constructor.prototype.close
*
* ========================================================================
*/
'use strict';
/**
* Our Alert class.
* @param {Element=} opt_element
* @constructor
*/
var Alert = function (opt_element) {
if (opt_element) {
$(opt_element).on('click', Alert._DISMISS_SELECTOR, Alert._handleDismiss(this))
}
}
/**
* @const
* @type {string}
*/
Alert['VERSION'] = '4.0.0'
/**
* @const
* @type {string}
* @private
*/
Alert._NAME = 'alert'
/**
* @const
* @type {string}
* @private
*/
Alert._DATA_KEY = 'bs.alert'
/**
* @const
* @type {string}
* @private
*/
Alert._DISMISS_SELECTOR = '[data-dismiss="alert"]'
/**
* @const
* @type {number}
* @private
*/
Alert._TRANSITION_DURATION = 150
/**
* @const
* @type {Function}
* @private
*/
Alert._JQUERY_NO_CONFLICT = $.fn[Alert._NAME]
+function ($) {
'use strict';
/** // ALERT CLASS DEFINITION
* @const // ======================
* @enum {string}
* @private
*/
Alert._Event = {
CLOSE : 'close.bs.alert',
CLOSED : 'closed.bs.alert'
}
var dismiss = '[data-dismiss="alert"]'
var Alert = function (el) {
$(el).on('click', dismiss, this.close)
}
/** Alert.VERSION = '3.3.4'
* @const
* @enum {string}
* @private
*/
Alert._ClassName = {
ALERT : 'alert',
FADE : 'fade',
IN : 'in'
}
Alert.TRANSITION_DURATION = 150
/** Alert.prototype.close = function (e) {
* Provides the jQuery Interface for the alert component. var $this = $(this)
* @param {string=} opt_config var selector = $this.attr('data-target')
* @this {jQuery}
* @return {jQuery}
* @private
*/
Alert._jQueryInterface = function (opt_config) {
return this.each(function () {
var $this = $(this)
var data = $this.data(Alert._DATA_KEY)
if (!data) { if (!selector) {
data = new Alert(this) selector = $this.attr('href')
$this.data(Alert._DATA_KEY, data) selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
} }
if (opt_config === 'close') { var $parent = $(selector)
data[opt_config](this)
}
})
}
if (e) e.preventDefault()
/** if (!$parent.length) {
* Close the alert component $parent = $this.closest('.alert')
* @param {Alert} alertInstance
* @return {Function}
* @private
*/
Alert._handleDismiss = function (alertInstance) {
return function (event) {
if (event) {
event.preventDefault()
} }
alertInstance['close'](this) $parent.trigger(e = $.Event('close.bs.alert'))
}
}
/** if (e.isDefaultPrevented()) return
* Close the alert component
* @param {Element} element
*/
Alert.prototype['close'] = function (element) {
var rootElement = this._getRootElement(element)
var customEvent = this._triggerCloseEvent(rootElement)
if (customEvent.isDefaultPrevented()) return $parent.removeClass('in')
this._removeElement(rootElement) function removeElement() {
} // detach from parent, fire event then clean up data
$parent.detach().trigger('closed.bs.alert').remove()
}
/**
* Tries to get the alert's root element
* @return {Element}
* @private
*/
Alert.prototype._getRootElement = function (element) {
var parent = false
var selector = Bootstrap.getSelectorFromElement(element)
if (selector) {
parent = $(selector)[0]
}
if (!parent) { $.support.transition && $parent.hasClass('fade') ?
parent = $(element).closest('.' + Alert._ClassName.ALERT)[0] $parent
.one('bsTransitionEnd', removeElement)
.emulateTransitionEnd(Alert.TRANSITION_DURATION) :
removeElement()
} }
return parent
}
/** // ALERT PLUGIN DEFINITION
* Trigger close event on element // =======================
* @return {$.Event}
* @private
*/
Alert.prototype._triggerCloseEvent = function (element) {
var closeEvent = $.Event(Alert._Event.CLOSE)
$(element).trigger(closeEvent)
return closeEvent
}
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)))
* Trigger closed event and remove element from dom if (typeof option == 'string') data[option].call($this)
* @private })
*/
Alert.prototype._removeElement = function (element) {
$(element).removeClass(Alert._ClassName.IN)
if (!Bootstrap.transition || !$(element).hasClass(Alert._ClassName.FADE)) {
this._destroyElement(element)
return
} }
$(element) var old = $.fn.alert
.one(Bootstrap.TRANSITION_END, this._destroyElement.bind(this, element))
.emulateTransitionEnd(Alert._TRANSITION_DURATION)
}
/** $.fn.alert = Plugin
* clean up any lingering jquery data and kill element $.fn.alert.Constructor = Alert
* @private
*/
Alert.prototype._destroyElement = function (element) {
$(element)
.detach()
.trigger(Alert._Event.CLOSED)
.remove()
}
/** // ALERT NO CONFLICT
* ------------------------------------------------------------------------ // =================
* jQuery Interface + noConflict implementaiton
* ------------------------------------------------------------------------
*/
/**
* @const
* @type {Function}
*/
$.fn[Alert._NAME] = Alert._jQueryInterface
/**
* @const
* @type {Function}
*/
$.fn[Alert._NAME]['Constructor'] = Alert
$.fn.alert.noConflict = function () {
$.fn.alert = old
return this
}
/**
* @return {Function}
*/
$.fn[Alert._NAME]['noConflict'] = function () {
$.fn[Alert._NAME] = Alert._JQUERY_NO_CONFLICT
return Alert._jQueryInterface
}
// ALERT DATA-API
// ==============
/** $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on('click.bs.alert.data-api', Alert._DISMISS_SELECTOR, Alert._handleDismiss(new Alert)) }(jQuery);
/** ======================================================================= /* ========================================================================
* Bootstrap: button.js v4.0.0 * Bootstrap: button.js v3.3.4
* http://getbootstrap.com/javascript/#buttons * http://getbootstrap.com/javascript/#buttons
* ======================================================================== * ========================================================================
* Copyright 2011-2015 Twitter, Inc. * Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== * ======================================================================== */
* @fileoverview - Bootstrap's generic button component.
*
* Note (@fat): Deprecated "setState" – imo, better solutions for managing a
* buttons state should exist outside this plugin.
*
* Public Methods & Properties:
*
* + $.button
* + $.button.noConflict
* + $.button.Constructor
* + $.button.Constructor.VERSION
* + $.button.Constructor.prototype.toggle
*
* ========================================================================
*/
'use strict';
/**
* Our Button class.
* @param {Element!} element
* @constructor
*/
var Button = function (element) {
/** @private {Element} */
this._element = element
}
/**
* @const
* @type {string}
*/
Button['VERSION'] = '4.0.0'
/**
* @const
* @type {string}
* @private
*/
Button._NAME = 'button'
/**
* @const
* @type {string}
* @private
*/
Button._DATA_KEY = 'bs.button'
/**
* @const
* @type {Function}
* @private
*/
Button._JQUERY_NO_CONFLICT = $.fn[Button._NAME]
/**
* @const
* @enum {string}
* @private
*/
Button._ClassName = {
ACTIVE : 'active',
BUTTON : 'btn',
FOCUS : 'focus'
}
/**
* @const
* @enum {string}
* @private
*/
Button._Selector = {
DATA_TOGGLE_CARROT : '[data-toggle^="button"]',
DATA_TOGGLE : '[data-toggle="buttons"]',
INPUT : 'input',
ACTIVE : '.active',
BUTTON : '.btn'
}
/**
* Provides the jQuery Interface for the Button component.
* @param {string=} opt_config
* @this {jQuery}
* @return {jQuery}
* @private
*/
Button._jQueryInterface = function (opt_config) {
return this.each(function () {
var data = $(this).data(Button._DATA_KEY)
if (!data) {
data = new Button(this)
$(this).data(Button._DATA_KEY, data)
}
if (opt_config === 'toggle') {
data[opt_config]() +function ($) {
} 'use strict';
})
} // BUTTON PUBLIC CLASS DEFINITION
// ==============================
/** var Button = function (element, options) {
* Toggle's the button active state this.$element = $(element)
*/ this.options = $.extend({}, Button.DEFAULTS, options)
Button.prototype['toggle'] = function () { this.isLoading = false
var triggerChangeEvent = true }
var rootElement = $(this._element).closest(Button._Selector.DATA_TOGGLE)[0]
Button.VERSION = '3.3.4'
if (rootElement) {
var input = $(this._element).find(Button._Selector.INPUT)[0] Button.DEFAULTS = {
if (input) { loadingText: 'loading...'
if (input.type == 'radio') { }
if (input.checked && $(this._element).hasClass(Button._ClassName.ACTIVE)) {
triggerChangeEvent = false Button.prototype.setState = function (state) {
} else { var d = 'disabled'
var activeElement = $(rootElement).find(Button._Selector.ACTIVE)[0] var $el = this.$element
if (activeElement) { var val = $el.is('input') ? 'val' : 'html'
$(activeElement).removeClass(Button._ClassName.ACTIVE) var data = $el.data()
}
} state += 'Text'
if (data.resetText == null) $el.data('resetText', $el[val]())
// push to event loop to allow forms to submit
setTimeout($.proxy(function () {
$el[val](data[state] == null ? this.options[state] : data[state])
if (state == 'loadingText') {
this.isLoading = true
$el.addClass(d).attr(d, d)
} else if (this.isLoading) {
this.isLoading = false
$el.removeClass(d).removeAttr(d)
} }
}, this), 0)
}
if (triggerChangeEvent) { Button.prototype.toggle = function () {
input.checked = !$(this._element).hasClass(Button._ClassName.ACTIVE) var changed = true
$(this._element).trigger('change') var $parent = this.$element.closest('[data-toggle="buttons"]')
if ($parent.length) {
var $input = this.$element.find('input')
if ($input.prop('type') == 'radio') {
if ($input.prop('checked')) changed = false
$parent.find('.active').removeClass('active')
this.$element.addClass('active')
} else if ($input.prop('type') == 'checkbox') {
if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
this.$element.toggleClass('active')
} }
$input.prop('checked', this.$element.hasClass('active'))
if (changed) $input.trigger('change')
} else {
this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
this.$element.toggleClass('active')
} }
} else {
this._element.setAttribute('aria-pressed', !$(this._element).hasClass(Button._ClassName.ACTIVE))
} }
if (triggerChangeEvent) {
$(this._element).toggleClass(Button._ClassName.ACTIVE)
}
}
// BUTTON PLUGIN DEFINITION
// ========================
/** function Plugin(option) {
* ------------------------------------------------------------------------ return this.each(function () {
* jQuery Interface + noConflict implementaiton var $this = $(this)
* ------------------------------------------------------------------------ var data = $this.data('bs.button')
*/ var options = typeof option == 'object' && option
/** if (!data) $this.data('bs.button', (data = new Button(this, options)))
* @const
* @type {Function}
*/
$.fn[Button._NAME] = Button._jQueryInterface
if (option == 'toggle') data.toggle()
else if (option) data.setState(option)
})
}
/** var old = $.fn.button
* @const
* @type {Function}
*/
$.fn[Button._NAME]['Constructor'] = Button
$.fn.button = Plugin
$.fn.button.Constructor = Button
/**
* @const
* @type {Function}
*/
$.fn[Button._NAME]['noConflict'] = function () {
$.fn[Button._NAME] = Button._JQUERY_NO_CONFLICT
return this
}
// BUTTON NO CONFLICT
// ==================
/** $.fn.button.noConflict = function () {
* ------------------------------------------------------------------------ $.fn.button = old
* Data Api implementation return this
* ------------------------------------------------------------------------ }
*/
$(document)
.on('click.bs.button.data-api', Button._Selector.DATA_TOGGLE_CARROT, function (event) {
event.preventDefault()
var button = event.target // BUTTON DATA-API
// ===============
if (!$(button).hasClass(Button._ClassName.BUTTON)) { $(document)
button = $(button).closest(Button._Selector.BUTTON) .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
} var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
Plugin.call($btn, 'toggle')
if (!($(e.target).is('input[type="radio"]') || $(e.target).is('input[type="checkbox"]'))) e.preventDefault()
})
.on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
$(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
})
Button._jQueryInterface.call($(button), 'toggle') }(jQuery);
})
.on('focus.bs.button.data-api blur.bs.button.data-api', Button._Selector.DATA_TOGGLE_CARROT, function (event) {
var button = $(event.target).closest(Button._Selector.BUTTON)[0]
$(button).toggleClass(Button._ClassName.FOCUS, /^focus(in)?$/.test(event.type))
})
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
jQuery.event.prototype.handleObj = function () {}
jQuery.event.prototype.handleObj.handler = function () {}
$.event.special = function () {}
$.event.trueHover = true
$.offset = {}
$.offset.setOffset = function (a,b,c) {}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
</script> </script>
<!-- Plugin sources --> <!-- Plugin sources -->
<script src="../../js/util.js"></script> <script>$.support.transition = false</script>
<script src="../../js/alert.js"></script> <script src="../../js/alert.js"></script>
<script src="../../js/button.js"></script> <script src="../../js/button.js"></script>
<script src="../../js/carousel.js"></script> <script src="../../js/carousel.js"></script>
...@@ -141,6 +141,7 @@ ...@@ -141,6 +141,7 @@
<script src="../../js/tab.js"></script> <script src="../../js/tab.js"></script>
<script src="../../js/tooltip.js"></script> <script src="../../js/tooltip.js"></script>
<script src="../../js/popover.js"></script> <script src="../../js/popover.js"></script>
<script src="../../js/affix.js"></script>
<!-- Unit tests --> <!-- Unit tests -->
<script src="unit/alert.js"></script> <script src="unit/alert.js"></script>
...@@ -153,6 +154,7 @@ ...@@ -153,6 +154,7 @@
<script src="unit/tab.js"></script> <script src="unit/tab.js"></script>
<script src="unit/tooltip.js"></script> <script src="unit/tooltip.js"></script>
<script src="unit/popover.js"></script> <script src="unit/popover.js"></script>
<script src="unit/affix.js"></script>
</head> </head>
<body> <body>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -400,7 +400,7 @@ $(function () { ...@@ -400,7 +400,7 @@ $(function () {
$body2 $body2
.toggleClass('in collapsing') .toggleClass('in collapsing')
.data('bs.collapse').setTransitioning(true) .data('bs.collapse').transitioning = 1
$target1.trigger('click') $target1.trigger('click')
......
This diff is collapsed.
...@@ -52,9 +52,9 @@ ...@@ -52,9 +52,9 @@
QUnit.moduleDone(function (obj) { QUnit.moduleDone(function (obj) {
if (obj.failed === 0) { if (obj.failed === 0) {
console.log('\r\u2714 All tests passed in "' + obj.name + '" module') console.log('\r\u221A All tests passed in "' + obj.name + '" module')
} else { } else {
console.log('\u2716 ' + obj.failed + ' tests failed in "' + obj.name + '" module') console.log('\u00D7 ' + obj.failed + ' tests failed in "' + obj.name + '" module')
} }
sendMessage('qunit.moduleDone', obj.name, obj.failed, obj.passed, obj.total) sendMessage('qunit.moduleDone', obj.name, obj.failed, obj.passed, obj.total)
}) })
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment