Created
November 1, 2013 00:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loadLinks: function(urls) { | |
// HTMLImports polyfill can load links out of documents, | |
// so make a document and put our links in it | |
var doc = document.createDocumentFragment(); | |
urls.forEach(function(url) { | |
var link = doc.appendChild(document.createElement('link')); | |
link.rel = "import"; | |
link.href = url; | |
}); | |
// ask the polyfill to load the links, do custom parsing | |
// stuff when they are ready | |
HTMLImports.importer.load(doc, function() { | |
doc.querySelectorAll('link').array().forEach( | |
function(link) { | |
HTMLImports.parser.parse(link.content); | |
CustomElements.parser.parse(link.content); | |
} | |
); | |
}); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment