assets/javascripts/material/components/util.js in material-sass-4.0.0 vs assets/javascripts/material/components/util.js in material-sass-4.1.0
- old
+ new
@@ -1,11 +1,12 @@
/*
* Global util js
- * Based on Bootstrap's (v4.0.0) `util.js`
+ * Based on Bootstrap's (v4.1.0) `util.js`
*/
var Util = function ($) {
var MAX_UID = 1000000;
+ var MILLISECONDS_MULTIPLIER = 1000;
var transition = false;
function getSpecialTransitionEndEvent() {
return {
bindType: transition.end,
@@ -71,9 +72,23 @@
var $selector = $(document).find(selector);
return $selector.length > 0 ? selector : null;
} catch (err) {
return null;
}
+ },
+ getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
+ if (!element) {
+ return 0;
+ }
+
+ var transitionDuration = $(element).css('transition-duration');
+
+ if (!transitionDuration) {
+ return 0;
+ }
+
+ transitionDuration = transitionDuration.split(',')[0];
+ return parseFloat(transitionDuration) * MILLISECONDS_MULTIPLIER;
},
getUID: function getUID(prefix) {
do {
// eslint-disable-next-line no-bitwise
prefix += ~~(Math.random() * MAX_UID);