mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-27 13:59:06 +02:00
Use named constants for magic numbers (#19992)
Mostly KeyboardEvent.which and MouseEvent.which values. [skip validator]
This commit is contained in:
@@ -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