curScript correction for async and defer

This commit is contained in:
guybedford 2016-07-19 16:56:32 +01:00
parent 4933661d58
commit adb5fdad65

View File

@ -7,6 +7,8 @@ var doPolyfill = typeof Promise === 'undefined';
if (typeof document !== 'undefined') {
var scripts = document.getElementsByTagName('script');
$__curScript = scripts[scripts.length - 1];
if ($__curScript.defer || $__curScript.async)
$__curScript = document.currentScript;
if (doPolyfill) {
var curPath = $__curScript.src;
var basePath = curPath.substr(0, curPath.lastIndexOf('/') + 1);