assets/javascripts/material/components/util.js in material-sass-4.0.0.beta3 vs assets/javascripts/material/components/util.js in material-sass-4.0.0
- old
+ new
@@ -1,18 +1,13 @@
/*
- * global util js
- * based on bootstrap's (v4.0.0-beta) util.js
+ * Global util js
+ * Based on Bootstrap's (v4.0.0) `util.js`
*/
var Util = function ($) {
var MAX_UID = 1000000;
var transition = false;
- function escapeId(selector) {
- selector = typeof $.escapeSelector === 'function' ? $.escapeSelector(selector).substr(1) : selector.replace(/(:|\.|\[|\]|,|=|@)/g, '\\$1');
- return selector;
- }
-
function getSpecialTransitionEndEvent() {
return {
bindType: transition.end,
delegateType: transition.end,
handle: function handle(event) {
@@ -33,11 +28,11 @@
$.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
}
}
function toType(obj) {
- return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
+ return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
}
function transitionEndEmulator(duration) {
var _this = this;
@@ -52,11 +47,11 @@
}, duration);
return this;
}
function transitionEndTest() {
- if (window.QUnit) {
+ if (typeof window !== 'undefined' && window.QUnit) {
return false;
}
return {
end: 'transitionend'
@@ -70,14 +65,10 @@
if (!selector || selector === '#') {
selector = element.getAttribute('href') || '';
}
- if (selector.charAt(0) === '#') {
- selector = escapeId(selector);
- }
-
try {
var $selector = $(document).find(selector);
return $selector.length > 0 ? selector : null;
} catch (err) {
return null;
@@ -118,6 +109,5 @@
}
};
setTransitionEndSupport();
return Util;
}($);
-//# sourceMappingURL=util.js.map
\ No newline at end of file