Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit ae34005

Browse files
committed
fix whenImportsReady
1 parent d5dc2f6 commit ae34005

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/HTMLImports.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -222,19 +222,23 @@ function whenImportsReady(callback, doc) {
222222
var loaded = 0, l = imports.length;
223223
function check() {
224224
loaded++;
225-
if (loaded == l) {
226-
callback && callback();
225+
if (loaded == l && callback) {
226+
callback();
227227
}
228228
}
229229
for (var i=0, imp; (i<l) && (imp=imports[i]); i++) {
230-
if (imp.import) {
230+
if (isImportLoaded(imp)) {
231231
check();
232232
} else {
233233
imp.addEventListener('load', check);
234234
}
235235
}
236236
}
237237

238+
function isImportLoaded(link) {
239+
return link.import && (useNative || link.import.__importParsed);
240+
}
241+
238242
// exports
239243
scope.hasNative = hasNative;
240244
scope.useNative = useNative;

0 commit comments

Comments
 (0)