mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-16 10:34:07 +02:00
dist
This commit is contained in:
22
js/dist/collapse.js
vendored
22
js/dist/collapse.js
vendored
@@ -89,12 +89,12 @@ var Collapse = function ($) {
|
||||
if (this._config.toggle) {
|
||||
this.toggle();
|
||||
}
|
||||
} // getters
|
||||
} // Getters
|
||||
|
||||
|
||||
var _proto = Collapse.prototype;
|
||||
|
||||
// public
|
||||
// Public
|
||||
_proto.toggle = function toggle() {
|
||||
if ($(this._element).hasClass(ClassName.SHOW)) {
|
||||
this.hide();
|
||||
@@ -116,7 +116,7 @@ var Collapse = function ($) {
|
||||
if (this._parent) {
|
||||
actives = $.makeArray($(this._parent).find(Selector.ACTIVES).filter("[data-parent=\"" + this._config.parent + "\"]"));
|
||||
|
||||
if (!actives.length) {
|
||||
if (actives.length === 0) {
|
||||
actives = null;
|
||||
}
|
||||
}
|
||||
@@ -149,7 +149,7 @@ var Collapse = function ($) {
|
||||
$(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
|
||||
this._element.style[dimension] = 0;
|
||||
|
||||
if (this._triggerArray.length) {
|
||||
if (this._triggerArray.length > 0) {
|
||||
$(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ var Collapse = function ($) {
|
||||
Util.reflow(this._element);
|
||||
$(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
|
||||
|
||||
if (this._triggerArray.length) {
|
||||
if (this._triggerArray.length > 0) {
|
||||
for (var i = 0; i < this._triggerArray.length; i++) {
|
||||
var trigger = this._triggerArray[i];
|
||||
var selector = Util.getSelectorFromElement(trigger);
|
||||
@@ -239,12 +239,12 @@ var Collapse = function ($) {
|
||||
this._element = null;
|
||||
this._triggerArray = null;
|
||||
this._isTransitioning = null;
|
||||
}; // private
|
||||
}; // Private
|
||||
|
||||
|
||||
_proto._getConfig = function _getConfig(config) {
|
||||
config = _extends({}, Default, config);
|
||||
config.toggle = Boolean(config.toggle); // coerce string values
|
||||
config.toggle = Boolean(config.toggle); // Coerce string values
|
||||
|
||||
Util.typeCheckConfig(NAME, config, DefaultType);
|
||||
return config;
|
||||
@@ -261,7 +261,7 @@ var Collapse = function ($) {
|
||||
var parent = null;
|
||||
|
||||
if (Util.isElement(this._config.parent)) {
|
||||
parent = this._config.parent; // it's a jQuery object
|
||||
parent = this._config.parent; // It's a jQuery object
|
||||
|
||||
if (typeof this._config.parent.jquery !== 'undefined') {
|
||||
parent = this._config.parent[0];
|
||||
@@ -281,11 +281,11 @@ var Collapse = function ($) {
|
||||
if (element) {
|
||||
var isOpen = $(element).hasClass(ClassName.SHOW);
|
||||
|
||||
if (triggerArray.length) {
|
||||
if (triggerArray.length > 0) {
|
||||
$(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
|
||||
}
|
||||
}
|
||||
}; // static
|
||||
}; // Static
|
||||
|
||||
|
||||
Collapse._getTargetFromElement = function _getTargetFromElement(element) {
|
||||
@@ -311,7 +311,7 @@ var Collapse = function ($) {
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (typeof data[config] === 'undefined') {
|
||||
throw new Error("No method named \"" + config + "\"");
|
||||
throw new TypeError("No method named \"" + config + "\"");
|
||||
}
|
||||
|
||||
data[config]();
|
||||
|
Reference in New Issue
Block a user