aboutsummaryrefslogtreecommitdiff
path: root/js/src/util.js
diff options
context:
space:
mode:
authorChris Rebert <[email protected]>2016-05-30 23:42:00 -0700
committerChris Rebert <[email protected]>2016-05-30 23:42:00 -0700
commit5a35ad6d74c8d9e5aa99a1fc255300a8fd2ac0b4 (patch)
tree8243d9d8cea3f86624462fc052c8957d7dc6ae6f /js/src/util.js
parent301dc70e1b04fdb70ac8e83a6906b6b27d7d2235 (diff)
downloadbootstrap-5a35ad6d74c8d9e5aa99a1fc255300a8fd2ac0b4.tar.xz
bootstrap-5a35ad6d74c8d9e5aa99a1fc255300a8fd2ac0b4.zip
Use named constants for magic numbers (#19992)
Mostly KeyboardEvent.which and MouseEvent.which values. [skip validator]
Diffstat (limited to 'js/src/util.js')
-rw-r--r--js/src/util.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/js/src/util.js b/js/src/util.js
index dba6e9bd6..070c5ea75 100644
--- a/js/src/util.js
+++ b/js/src/util.js
@@ -16,6 +16,8 @@ const Util = (($) => {
let transition = false
+ const MAX_UID = 1000000
+
const TransitionEndEvent = {
WebkitTransition : 'webkitTransitionEnd',
MozTransition : 'transitionend',
@@ -100,7 +102,7 @@ const Util = (($) => {
getUID(prefix) {
do {
/* eslint-disable no-bitwise */
- prefix += ~~(Math.random() * 1000000) // "~~" acts like a faster Math.floor() here
+ prefix += ~~(Math.random() * MAX_UID) // "~~" acts like a faster Math.floor() here
/* eslint-enable no-bitwise */
} while (document.getElementById(prefix))
return prefix