diff options
| author | Mark Otto <[email protected]> | 2017-05-01 21:54:50 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-05-01 21:54:50 -0700 |
| commit | 8c7fe6cf147e98fb5d8096f6e6536bcb4e207586 (patch) | |
| tree | d33635083f70814945e92cb17957b6c522073379 /js/src | |
| parent | ca44f5b03a9707dda74e1aa3f92a1b54de3ec6d5 (diff) | |
| parent | e00de46540818fa11feb6d1f0e8b0089ba56f082 (diff) | |
| download | bootstrap-8c7fe6cf147e98fb5d8096f6e6536bcb4e207586.tar.xz bootstrap-8c7fe6cf147e98fb5d8096f6e6536bcb4e207586.zip | |
Merge branch 'v4-dev' into form-tweaks
Diffstat (limited to 'js/src')
| -rw-r--r-- | js/src/button.js | 6 | ||||
| -rw-r--r-- | js/src/collapse.js | 16 | ||||
| -rw-r--r-- | js/src/tab.js | 2 |
3 files changed, 11 insertions, 13 deletions
diff --git a/js/src/button.js b/js/src/button.js index 6295d0db0..722fd489d 100644 --- a/js/src/button.js +++ b/js/src/button.js @@ -90,6 +90,12 @@ const Button = (($) => { } if (triggerChangeEvent) { + if (input.hasAttribute('disabled') || + rootElement.hasAttribute('disabled') || + input.classList.contains('disabled') || + rootElement.classList.contains('disabled')) { + return + } input.checked = !$(this._element).hasClass(ClassName.ACTIVE) $(input).trigger('change') } diff --git a/js/src/collapse.js b/js/src/collapse.js index dec272297..bf1c738f5 100644 --- a/js/src/collapse.js +++ b/js/src/collapse.js @@ -56,9 +56,8 @@ const Collapse = (($) => { } const Selector = { - ACTIVES : '.card > .show, .card > .collapsing', - DATA_TOGGLE : '[data-toggle="collapse"]', - DATA_CHILDREN : 'data-children' + ACTIVES : '.show, .collapsing', + DATA_TOGGLE : '[data-toggle="collapse"]' } @@ -78,20 +77,13 @@ const Collapse = (($) => { `[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) { - const 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() } @@ -129,7 +121,7 @@ const Collapse = (($) => { let activesData if (this._parent) { - actives = $.makeArray($(this._parent).find(this._selectorActives)) + actives = $.makeArray($(this._parent).children().children(Selector.ACTIVES)) if (!actives.length) { actives = null } diff --git a/js/src/tab.js b/js/src/tab.js index 6f8187d17..c7bc520df 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -140,7 +140,7 @@ const Tab = (($) => { } dispose() { - $.removeClass(this._element, DATA_KEY) + $.removeData(this._element, DATA_KEY) this._element = null } |
