Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Rebert <github@chrisrebert.com>2016-05-31 09:42:00 +0300
committerChris Rebert <github@chrisrebert.com>2016-05-31 09:42:00 +0300
commit5a35ad6d74c8d9e5aa99a1fc255300a8fd2ac0b4 (patch)
tree8243d9d8cea3f86624462fc052c8957d7dc6ae6f /js/src/modal.js
parent301dc70e1b04fdb70ac8e83a6906b6b27d7d2235 (diff)
Use named constants for magic numbers (#19992)
Mostly KeyboardEvent.which and MouseEvent.which values. [skip validator]
Diffstat (limited to 'js/src/modal.js')
-rw-r--r--js/src/modal.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/js/src/modal.js b/js/src/modal.js
index f52af09a2a..2f26bc0d92 100644
--- a/js/src/modal.js
+++ b/js/src/modal.js
@@ -25,6 +25,7 @@ const Modal = (($) => {
const JQUERY_NO_CONFLICT = $.fn[NAME]
const TRANSITION_DURATION = 300
const BACKDROP_TRANSITION_DURATION = 150
+ const ESCAPE_KEYCODE = 27 // Escape (Esc) key
const Default = {
backdrop : true,
@@ -271,7 +272,7 @@ const Modal = (($) => {
_setEscapeEvent() {
if (this._isShown && this._config.keyboard) {
$(this._element).on(Event.KEYDOWN_DISMISS, (event) => {
- if (event.which === 27) {
+ if (event.which === ESCAPE_KEYCODE) {
this.hide()
}
})