Defers whenReady until after any imports that are queued by custom elements upgrading have been loaded.

This commit is contained in:
Steven Orvell
2017-02-10 16:32:05 -08:00
parent f214a22d17
commit 9d0052cb15
9 changed files with 17 additions and 10 deletions

View File

@@ -21,6 +21,7 @@
let cb = flushCallback;
flushCallback = null;
cb();
return true;
}
}
let origWhenReady = HTMLImports.whenReady;
@@ -31,8 +32,14 @@
HTMLImports.whenReady = function(cb) {
origWhenReady(function() {
runAndClearCallback();
cb();
// custom element code may add dynamic imports
// to match processing of native custom elements before
// domContentLoaded, we wait for these imports to resolve first.
if (runAndClearCallback()) {
origWhenReady(cb);
} else {
cb();
}
});
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long