diff options
author | XhmikosR <xhmikosr@gmail.com> | 2020-05-13 21:53:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-13 21:53:43 +0300 |
commit | de7af5ee0738d08ef2d6702654834beb5bfce35e (patch) | |
tree | 371b751a7f96f96399e53d1767b8f0c4610cb268 /js/dist/button.js | |
parent | 53eb7d38830f1e7c593069c8f5b40f4127563317 (diff) |
Dist (#30694)
Diffstat (limited to 'js/dist/button.js')
-rw-r--r-- | js/dist/button.js | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/js/dist/button.js b/js/dist/button.js index 62e2d8d370..a77a4a8392 100644 --- a/js/dist/button.js +++ b/js/dist/button.js @@ -59,7 +59,6 @@ var EVENT_KEY = "." + DATA_KEY; var DATA_API_KEY = '.data-api'; var CLASS_NAME_ACTIVE = 'active'; - var CLASS_NAME_BUTTON = 'btn'; var CLASS_NAME_DISABLED = 'disabled'; var CLASS_NAME_FOCUS = 'focus'; var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]'; @@ -89,7 +88,8 @@ _proto.toggle = function toggle() { var triggerChangeEvent = true; var addAriaPressed = true; - var rootElement = SelectorEngine.closest(this._element, SELECTOR_DATA_TOGGLE); + + var rootElement = this._element.closest(SELECTOR_DATA_TOGGLE); if (rootElement) { var input = SelectorEngine.findOne(SELECTOR_INPUT, this._element); @@ -170,12 +170,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { event.preventDefault(); - var button = event.target; - - if (!button.classList.contains(CLASS_NAME_BUTTON)) { - button = SelectorEngine.closest(button, SELECTOR_BUTTON); - } - + var button = event.target.closest(SELECTOR_BUTTON); var data = Data.getData(button, DATA_KEY); if (!data) { @@ -185,14 +180,14 @@ data.toggle(); }); EventHandler.on(document, EVENT_FOCUS_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { - var button = SelectorEngine.closest(event.target, SELECTOR_BUTTON); + var button = event.target.closest(SELECTOR_BUTTON); if (button) { button.classList.add(CLASS_NAME_FOCUS); } }); EventHandler.on(document, EVENT_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { - var button = SelectorEngine.closest(event.target, SELECTOR_BUTTON); + var button = event.target.closest(SELECTOR_BUTTON); if (button) { button.classList.remove(CLASS_NAME_FOCUS); |