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); } ); }); },