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

Commit

Permalink
Fixes a problem where imports loaded at the same url would not have t…
Browse files Browse the repository at this point in the history
…he content associated with them.

- 2 minor bugs corrected.
- test added to verify that imports have content associated with them.
  • Loading branch information
Steve Orvell committed Apr 12, 2013
1 parent 8c842e1 commit 882a9b6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/HTMLImports.js
Expand Up @@ -135,7 +135,7 @@ Loader.prototype = {
}
if (this.cache[inUrl]) {
// complete load using cache data
this.onload(inElt, inUrl, loader.cache[inUrl]);
this.onload(inUrl, inElt, loader.cache[inUrl]);
// finished this transaction
this.tail();
// don't need fetch
Expand All @@ -157,7 +157,7 @@ Loader.prototype = {
}
loader.pending[inUrl].forEach(function(e) {
if (!inErr) {
this.onload(inUrl, inElt, inResource);
this.onload(inUrl, e, inResource);
}
this.tail();
}, this);
Expand Down
11 changes: 11 additions & 0 deletions test/html/HTMLImports.html
Expand Up @@ -19,6 +19,17 @@
'must cache exactly five resources');
chai.assert.equal(4, Object.keys(HTMLImports.documents).length,
'must cache exactly four documents');

Object.keys(HTMLImports.documents).forEach(function(key) {
var doc = HTMLImports.documents[key];
var links = doc.querySelectorAll('link[rel=import]');
Array.prototype.forEach.call(links, function(link) {
var href = link.getAttribute('href');
if (href.indexOf('404') <= 0) {
chai.assert.isDefined(link.content, 'import should have content');
}
});
})
done();
});
</script>
Expand Down

0 comments on commit 882a9b6

Please sign in to comment.