Permalink
Browse files

Cherry-pick regression fixes from new-build

These fixes need to be fixed in production ASAP.
  • Loading branch information...
kabel committed Sep 23, 2015
1 parent f00e2a4 commit f18ea837cfdb28cbde3ed0035dc8cbdaa4bd75c0
Showing with 9 additions and 8 deletions.
  1. +8 −7 wdn/templates_4.0/scripts/modernizr-wdn.js
  2. +1 −1 wdn/templates_4.0/scripts/wdn.js
@@ -974,32 +974,33 @@ Modernizr.selectorSupported = function(selector) {
link.rel = 'stylesheet';
link.href = 'data:text/css;base64,I21vZGVybml6ci1jc3Nsb2Fke2Rpc3BsYXk6bm9uZX0=';
-
+
onDone = function(result) {
Modernizr.addTest(testName, result);
if (link.parentNode) {
link.parentNode.removeChild(link);
}
link = null;
- }
+ onDone = function() {};
+ };
if (!Modernizr.hasEvent('load', link)) {
onDone(false);
return;
}
-
+
link.onload = function() {
clearTimeout(failTimeout);
- onDone(!!(link.sheet || link.styleSheet));
+ onDone(!!(link && (link.sheet || link.styleSheet)));
};
-
+
link.onerror = function() {
clearTimeout(failTimeout);
onDone(true);
};
-
+
(head || root).insertBefore(link, (head || root).firstChild);
-
+
failTimeout = setTimeout(function() {
onDone(false);
}, 100);
@@ -109,7 +109,7 @@
}
_head.appendChild(link);
- } else if (callbackIfLoaded !== false) {
+ } else if (callback && callbackIfLoaded !== false) {
callback();
}
},

0 comments on commit f18ea83

Please sign in to comment.