aboutsummaryrefslogtreecommitdiff
path: root/js/src/util.js
diff options
context:
space:
mode:
authorJohann-S <[email protected]>2018-03-13 10:38:36 +0100
committerJohann-S <[email protected]>2018-03-13 12:57:44 +0100
commit2c41b0aea6b2b1d1f1d812ab4455bea4a0759428 (patch)
tree69606a554481dae10238eb52e780f77a548e32a8 /js/src/util.js
parent1fadad1c33b99b94a4a821fe5c62c8064d129424 (diff)
downloadbootstrap-2c41b0aea6b2b1d1f1d812ab4455bea4a0759428.tar.xz
bootstrap-2c41b0aea6b2b1d1f1d812ab4455bea4a0759428.zip
fix get the transition duration parent
Diffstat (limited to 'js/src/util.js')
-rw-r--r--js/src/util.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/js/src/util.js b/js/src/util.js
index 05a69977c..1b1f13bea 100644
--- a/js/src/util.js
+++ b/js/src/util.js
@@ -106,19 +106,22 @@ const Util = (($) => {
},
getTransitionDurationFromElement(element) {
+ if (!element) {
+ return 0
+ }
+
// Get transition-duration of the element
let transitionDuration = $(element).css('transition-duration')
+ const floatTransitionDuration = parseFloat(transitionDuration)
// Return 0 if element or transition duration is not found
- if (!transitionDuration) {
+ if (!floatTransitionDuration) {
return 0
}
// If multiple durations are defined, take the first
transitionDuration = transitionDuration.split(',')[0]
- // jQuery always converts transition durations into seconds,
- // so multiply by 1000
return parseFloat(transitionDuration) * MILLISECONDS_MULTIPLIER
},