1
0
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:
Chris Rebert
2016-05-30 23:42:00 -07:00
parent 301dc70e1b
commit 5a35ad6d74
4 changed files with 25 additions and 16 deletions

View File

@@ -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