FIX: Concurently loading deferred loading of a script incorrectly resolves the promise.

This commit is contained in:
Guo Xiang Tan 2017-07-17 14:41:46 +09:00
parent d613f3f559
commit 2ddf2e0e95
1 changed files with 4 additions and 1 deletions

View File

@ -37,7 +37,10 @@ export default function loadScript(url, opts) {
$('script').each((i, tag) => { $('script').each((i, tag) => {
const src = tag.getAttribute('src'); const src = tag.getAttribute('src');
if (src) _loaded[tag.getAttribute('src')] = true;
// For some reason, a script tag with `url` as the source is appended into
// the head tag while loading the script.
if (src && src !== url) _loaded[tag.getAttribute('src')] = true;
}); });