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

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sorvell committed Sep 10, 2014
1 parent 0d443fe commit 35e6cbe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,14 @@ function watchImportsLoad(callback, doc) {

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

// TODO(sorvell): Workaround for
Expand Down
5 changes: 2 additions & 3 deletions test/html/HTMLImportsLoaded-native.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@
<script src="../../src/base.js"></script>
<script src="../../../tools/test/htmltest.js"></script>
<script src="../../../tools/test/chai/chai.js"></script>

<link rel="import" href="imports/import-1.html">
</head>
<body>
<link rel="import" href="imports/import-1.html">
<script>
if (!HTMLImports.useNative) {
done();
} else {
addEventListener('HTMLImportsLoaded', function() {
addEventListener('HTMLImportsLoaded', function(e) {
chai.assert.ok(true, 'HTMLImportsLoaded');
done();
});
Expand Down

0 comments on commit 35e6cbe

Please sign in to comment.