zengjialuo/kittyjs

IE11 does not support script.readyState

wonsure2 opened this issue · 0 comments

code:

// For IE6-9 browsers, the script onload event may not fire right
// after the script is evaluated. Kris Zyp found that it
// could query the script nodes and the one that is in "interactive"
// mode indicates the current script
// ref: http://goo.gl/JHfFW
var scripts = document.getElementsByTagName('script');

// I create a array here, otherwise the iterator will not be executed in each method
var scriptsArr = [];
for (var i = 0; i < scripts.length; i++) {
scriptsArr.push(scripts.item(i));
}

each(scriptsArr, function (script) {
if (script.readyState === 'interactive') { // script.readyState is undefined in IE11 !!!!!!!!!!!!!!!!!!!!!!!!!!!
interactiveScript = script;
return false;
}
});
return interactiveScript;

problem:
script.readyState is undefined in IE11,so it can not get the script which is running