assets/javascripts/material/components/util.js in material-sass-4.1.0 vs assets/javascripts/material/components/util.js in material-sass-4.1.1
- old
+ new
@@ -1,18 +1,18 @@
/*
* Global util js
- * Based on Bootstrap's (v4.1.0) `util.js`
+ * Based on Bootstrap's (v4.1.X) `util.js`
*/
var Util = function ($) {
var MAX_UID = 1000000;
var MILLISECONDS_MULTIPLIER = 1000;
- var transition = false;
+ var TRANSITION_END = 'transitionend';
function getSpecialTransitionEndEvent() {
return {
- bindType: transition.end,
- delegateType: transition.end,
+ bindType: TRANSITION_END,
+ delegateType: TRANSITION_END,
handle: function handle(event) {
if ($(event.target).is(this)) {
return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
}
@@ -20,16 +20,12 @@
}
};
}
function setTransitionEndSupport() {
- transition = transitionEndTest();
$.fn.emulateTransitionEnd = transitionEndEmulator;
-
- if (Util.supportsTransitionEnd()) {
- $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
- }
+ $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
}
function toType(obj) {
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
}
@@ -47,20 +43,10 @@
}
}, duration);
return this;
}
- function transitionEndTest() {
- if (typeof window !== 'undefined' && window.QUnit) {
- return false;
- }
-
- return {
- end: 'transitionend'
- };
- }
-
var Util = {
TRANSITION_END: 'mdTransitionEnd',
getSelectorFromElement: function getSelectorFromElement(element) {
var selector = element.getAttribute('data-target');
@@ -102,13 +88,13 @@
},
reflow: function reflow(element) {
return element.offsetHeight;
},
supportsTransitionEnd: function supportsTransitionEnd() {
- return Boolean(transition);
+ return Boolean(TRANSITION_END);
},
triggerTransitionEnd: function triggerTransitionEnd(element) {
- $(element).trigger(transition.end);
+ $(element).trigger(TRANSITION_END);
},
typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
for (var property in configTypes) {
if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
var expectedTypes = configTypes[property];