Skip to content

Commit

Permalink
Follow-up to twbs#13907: simplify JS logic for focus shim
Browse files Browse the repository at this point in the history
  • Loading branch information
hnrch02 committed Jul 16, 2014
1 parent dd22f59 commit cc7fab8
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions js/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
// ===============

Expand All @@ -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);

0 comments on commit cc7fab8

Please sign in to comment.