mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-16 10:34:07 +02:00
grunt
This commit is contained in:
17
js/dist/collapse.js
vendored
17
js/dist/collapse.js
vendored
@@ -59,7 +59,8 @@ var Collapse = function ($) {
|
||||
|
||||
var Selector = {
|
||||
ACTIVES: '.card > .show, .card > .collapsing',
|
||||
DATA_TOGGLE: '[data-toggle="collapse"]'
|
||||
DATA_TOGGLE: '[data-toggle="collapse"]',
|
||||
DATA_CHILDREN: 'data-children'
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -76,13 +77,20 @@ var Collapse = function ($) {
|
||||
this._element = element;
|
||||
this._config = this._getConfig(config);
|
||||
this._triggerArray = $.makeArray($('[data-toggle="collapse"][href="#' + element.id + '"],' + ('[data-toggle="collapse"][data-target="#' + element.id + '"]')));
|
||||
|
||||
this._parent = this._config.parent ? this._getParent() : null;
|
||||
|
||||
if (!this._config.parent) {
|
||||
this._addAriaAndCollapsedClass(this._element, this._triggerArray);
|
||||
}
|
||||
|
||||
this._selectorActives = Selector.ACTIVES;
|
||||
if (this._parent) {
|
||||
var childrenSelector = this._parent.hasAttribute(Selector.DATA_CHILDREN) ? this._parent.getAttribute(Selector.DATA_CHILDREN) : null;
|
||||
if (childrenSelector !== null) {
|
||||
this._selectorActives = childrenSelector + ' > .show, ' + childrenSelector + ' > .collapsing';
|
||||
}
|
||||
}
|
||||
|
||||
if (this._config.toggle) {
|
||||
this.toggle();
|
||||
}
|
||||
@@ -115,7 +123,7 @@ var Collapse = function ($) {
|
||||
var activesData = void 0;
|
||||
|
||||
if (this._parent) {
|
||||
actives = $.makeArray($(this._parent).find(Selector.ACTIVES));
|
||||
actives = $.makeArray($(this._parent).find(this._selectorActives));
|
||||
if (!actives.length) {
|
||||
actives = null;
|
||||
}
|
||||
@@ -195,9 +203,8 @@ var Collapse = function ($) {
|
||||
}
|
||||
|
||||
var dimension = this._getDimension();
|
||||
var offsetDimension = dimension === Dimension.WIDTH ? 'offsetWidth' : 'offsetHeight';
|
||||
|
||||
this._element.style[dimension] = this._element[offsetDimension] + 'px';
|
||||
this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + 'px';
|
||||
|
||||
Util.reflow(this._element);
|
||||
|
||||
|
Reference in New Issue
Block a user