0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-03-02 02:29:24 +01:00

Merge pull request #12761 from hnrch02/no-event-aliases

Remove event aliases from JavaScript
This commit is contained in:
Mark Otto 2014-02-21 15:14:22 -08:00
commit 70b875ceb3
3 changed files with 16 additions and 16 deletions

16
dist/js/bootstrap.js vendored
View File

@ -675,7 +675,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
.toggleClass('open') .toggleClass('open')
.trigger('shown.bs.dropdown', relatedTarget) .trigger('shown.bs.dropdown', relatedTarget)
$this.focus() $this.trigger('focus')
} }
return false return false
@ -695,8 +695,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var isActive = $parent.hasClass('open') var isActive = $parent.hasClass('open')
if (!isActive || (isActive && e.keyCode == 27)) { if (!isActive || (isActive && e.keyCode == 27)) {
if (e.which == 27) $parent.find(toggle).focus() if (e.which == 27) $parent.find(toggle).trigger('focus')
return $this.click() return $this.trigger('click')
} }
var desc = ' li:not(.divider):visible a' var desc = ' li:not(.divider):visible a'
@ -710,7 +710,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
if (e.keyCode == 40 && index < $items.length - 1) index++ // down if (e.keyCode == 40 && index < $items.length - 1) index++ // down
if (!~index) index = 0 if (!~index) index = 0
$items.eq(index).focus() $items.eq(index).trigger('focus')
} }
function clearMenus(e) { function clearMenus(e) {
@ -857,10 +857,10 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
transition ? transition ?
that.$element.find('.modal-dialog') // wait for modal to slide in that.$element.find('.modal-dialog') // wait for modal to slide in
.one($.support.transition.end, function () { .one($.support.transition.end, function () {
that.$element.focus().trigger(e) that.$element.trigger('focus').trigger(e)
}) })
.emulateTransitionEnd(300) : .emulateTransitionEnd(300) :
that.$element.focus().trigger(e) that.$element.trigger('focus').trigger(e)
}) })
} }
@ -896,7 +896,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
.off('focusin.bs.modal') // guard against infinite focus loop .off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', $.proxy(function (e) { .on('focusin.bs.modal', $.proxy(function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
this.$element.focus() this.$element.trigger('focus')
} }
}, this)) }, this))
} }
@ -1011,7 +1011,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
$target $target
.modal(option, this) .modal(option, this)
.one('hide', function () { .one('hide', function () {
$this.is(':visible') && $this.focus() $this.is(':visible') && $this.trigger('focus')
}) })
}) })

View File

@ -44,7 +44,7 @@
.toggleClass('open') .toggleClass('open')
.trigger('shown.bs.dropdown', relatedTarget) .trigger('shown.bs.dropdown', relatedTarget)
$this.focus() $this.trigger('focus')
} }
return false return false
@ -64,8 +64,8 @@
var isActive = $parent.hasClass('open') var isActive = $parent.hasClass('open')
if (!isActive || (isActive && e.keyCode == 27)) { if (!isActive || (isActive && e.keyCode == 27)) {
if (e.which == 27) $parent.find(toggle).focus() if (e.which == 27) $parent.find(toggle).trigger('focus')
return $this.click() return $this.trigger('click')
} }
var desc = ' li:not(.divider):visible a' var desc = ' li:not(.divider):visible a'
@ -79,7 +79,7 @@
if (e.keyCode == 40 && index < $items.length - 1) index++ // down if (e.keyCode == 40 && index < $items.length - 1) index++ // down
if (!~index) index = 0 if (!~index) index = 0
$items.eq(index).focus() $items.eq(index).trigger('focus')
} }
function clearMenus(e) { function clearMenus(e) {

View File

@ -78,10 +78,10 @@
transition ? transition ?
that.$element.find('.modal-dialog') // wait for modal to slide in that.$element.find('.modal-dialog') // wait for modal to slide in
.one($.support.transition.end, function () { .one($.support.transition.end, function () {
that.$element.focus().trigger(e) that.$element.trigger('focus').trigger(e)
}) })
.emulateTransitionEnd(300) : .emulateTransitionEnd(300) :
that.$element.focus().trigger(e) that.$element.trigger('focus').trigger(e)
}) })
} }
@ -117,7 +117,7 @@
.off('focusin.bs.modal') // guard against infinite focus loop .off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', $.proxy(function (e) { .on('focusin.bs.modal', $.proxy(function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
this.$element.focus() this.$element.trigger('focus')
} }
}, this)) }, this))
} }
@ -232,7 +232,7 @@
$target $target
.modal(option, this) .modal(option, this)
.one('hide', function () { .one('hide', function () {
$this.is(':visible') && $this.focus() $this.is(':visible') && $this.trigger('focus')
}) })
}) })