mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-05-24 14:04:09 +03:00
Use named constants for magic numbers (#19992)
Mostly KeyboardEvent.which and MouseEvent.which values. [skip validator]
This commit is contained in:
+3
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user