Permalink
Browse files

Fixes a problem where imports loaded at the same url would not have t…

…he content associated with them.

- 2 minor bugs corrected.
- test added to verify that imports have content associated with them.
  • Loading branch information...
sorvell committed Apr 12, 2013
1 parent 8c842e1 commit 882a9b6cc53d41d46967346b0b7e32edc4a6f7b9
Showing with 13 additions and 2 deletions.
  1. +2 −2 src/HTMLImports.js
  2. +11 −0 test/html/HTMLImports.html
View
@@ -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
@@ -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);
View
@@ -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>

0 comments on commit 882a9b6

Please sign in to comment.