Only add defer to inline script tags, addressed #334

This commit is contained in:
Tom Ashworth 2012-11-27 15:01:10 +00:00
parent 1bffefedf5
commit 89be873dba

View File

@ -160,7 +160,13 @@ function getPreparedCode(nojs) {
// }
if (jsbin.ie && re.scriptopen.test(source)) {
source = source.replace(re.scriptopen, '<script defer');
source = source.replace(/<script(.*?)>/gi, function (all, match) {
if (match.indexOf('src') !== -1) {
return all;
} else {
return '<script defer' + match + '>';
}
});
}
// read the element out of the source code and plug it in to our document.title