From 5a35ad6d74c8d9e5aa99a1fc255300a8fd2ac0b4 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Mon, 30 May 2016 23:42:00 -0700 Subject: Use named constants for magic numbers (#19992) Mostly KeyboardEvent.which and MouseEvent.which values. [skip validator] --- js/src/util.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'js/src/util.js') 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 -- cgit v1.2.3 From c4add0c2f30b8404bd1d227b16d7668a236c1d63 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Tue, 31 May 2016 00:45:32 -0700 Subject: Comply with consistent-return ESLint rule --- js/src/util.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/src/util.js') diff --git a/js/src/util.js b/js/src/util.js index 070c5ea75..b779c448f 100644 --- a/js/src/util.js +++ b/js/src/util.js @@ -42,6 +42,7 @@ const Util = (($) => { if ($(event.target).is(this)) { return event.handleObj.handler.apply(this, arguments) } + return undefined } } } -- cgit v1.2.3