Merge pull request #4887 from ahocevar/jsonp-test

Use less aggressive DOM function overrides
This commit is contained in:
Andreas Hocevar
2016-02-23 14:27:14 +01:00
+18 -9
View File
@@ -22,16 +22,25 @@ describe('ol.net', function() {
} }
beforeEach(function() { beforeEach(function() {
document.createElement = function() { var element = {};
return {} document.createElement = function(arg) {
if (arg == 'script') {
return element;
} else {
return origCreateElement.apply(goog.global.document, arguments);
}
}; };
head.appendChild = function(element) { head.appendChild = function(el) {
element.parentNode = { if (el === element) {
removeChild: removeChild element.parentNode = {
}; removeChild: removeChild
origSetTimeout(function() { };
goog.global[key](element.src); origSetTimeout(function() {
}, 0); goog.global[key](element.src);
}, 0);
} else {
origAppendChild.apply(head, arguments);
}
}; };
goog.global.setTimeout = function(fn, time) { goog.global.setTimeout = function(fn, time) {
origSetTimeout(fn, 100); origSetTimeout(fn, 100);