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

Commit

Permalink
Update to follow current spec: (1) make imported document available v…
Browse files Browse the repository at this point in the history
…ia link.import, (2) fire load event when import is loaded.
  • Loading branch information
sorvell committed Nov 15, 2013
1 parent 485214e commit 79fec83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/HTMLImports.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,9 @@ var importer = {
importer.preload(document);
}
// store import record
elt.import = {
href: url,
ownerNode: elt,
content: document
};
elt.import = document;
elt.import.href = url;
elt.import.ownerNode = elt;
// store document resource
elt.content = resource = document;
}
Expand Down
6 changes: 4 additions & 2 deletions src/Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ var importParser = {
},
parseLink: function(linkElt) {
if (isDocumentLink(linkElt)) {
if (linkElt.content) {
importParser.parse(linkElt.content);
if (linkElt.import) {
importParser.parse(linkElt.import);
// fire load event
linkElt.dispatchEvent(new CustomEvent('load'));
}
} else {
this.parseGeneric(linkElt);
Expand Down

0 comments on commit 79fec83

Please sign in to comment.