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

Commit 35e6cbe

Browse files
committed
1 parent 0d443fe commit 35e6cbe

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/base.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,14 @@ function watchImportsLoad(callback, doc) {
111111

112112
// NOTE: test for native imports loading is based on explicitly watching
113113
// all imports (see below).
114+
// We cannot rely on this entirely without watching the entire document
115+
// for import links. For perf reasons, currently only head is watched.
116+
// Instead, we fallback to checking if the import property is available
117+
// and the document is not itself loading.
114118
function isImportLoaded(link) {
115-
return useNative ? link.__loaded : link.__importParsed;
119+
return useNative ? link.__loaded ||
120+
(link.import && link.import.readyState !== 'loading') :
121+
link.__importParsed;
116122
}
117123

118124
// TODO(sorvell): Workaround for

test/html/HTMLImportsLoaded-native.html

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@
1919
<script src="../../src/base.js"></script>
2020
<script src="../../../tools/test/htmltest.js"></script>
2121
<script src="../../../tools/test/chai/chai.js"></script>
22-
23-
<link rel="import" href="imports/import-1.html">
2422
</head>
2523
<body>
24+
<link rel="import" href="imports/import-1.html">
2625
<script>
2726
if (!HTMLImports.useNative) {
2827
done();
2928
} else {
30-
addEventListener('HTMLImportsLoaded', function() {
29+
addEventListener('HTMLImportsLoaded', function(e) {
3130
chai.assert.ok(true, 'HTMLImportsLoaded');
3231
done();
3332
});

0 commit comments

Comments
 (0)