diff options
| author | Heinrich Fenkart <[email protected]> | 2014-07-16 08:44:56 +0200 |
|---|---|---|
| committer | Heinrich Fenkart <[email protected]> | 2014-07-16 08:44:56 +0200 |
| commit | cc7fab893d2e3c24fdc0e26fd47478cc0006200b (patch) | |
| tree | 00fd029732fdda1449029dda61e91faa0e3cd211 /js/button.js | |
| parent | dd22f599998cc07c18b6643a856d5acda6c5c122 (diff) | |
| download | bootstrap-cc7fab893d2e3c24fdc0e26fd47478cc0006200b.tar.xz bootstrap-cc7fab893d2e3c24fdc0e26fd47478cc0006200b.zip | |
Follow-up to #13907: simplify JS logic for focus shim
Diffstat (limited to 'js/button.js')
| -rw-r--r-- | js/button.js | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/js/button.js b/js/button.js index 7e2a6e4e8..b3e944c59 100644 --- a/js/button.js +++ b/js/button.js @@ -97,15 +97,6 @@ } - // FOCUS SHIM (FOR BUTTON GROUPS) - // ============================== - - function getBtnTarget(target) { - var $target = $(target) - return $target.hasClass('btn') ? $target : $target.parent('.btn') - } - - // BUTTON DATA-API // =============== @@ -116,11 +107,8 @@ Plugin.call($btn, 'toggle') e.preventDefault() }) - .on('focus.bs.button.data-api', '[data-toggle^="button"]', function (e) { - getBtnTarget(e.target).addClass('focus') - }) - .on('blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { - getBtnTarget(e.target).removeClass('focus') + .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { + $(e.target).closest('.btn').toggleClass('focus', e.type == 'focus') }) }(jQuery); |
