Skip to content

Instantly share code, notes, and snippets.

View reosablo's full-sized avatar

Reo reosablo

View GitHub Profile
// Templates inside SVG won't work in polymer-1.0 without some monkeypatching.
(function() {
var templates = document.currentScript.parentElement.querySelector("template").content.querySelectorAll("svg template");
Array.prototype.slice.call(templates).reverse().forEach(function(template) {
var new_template = template.ownerDocument.createElement("template");
template.parentElement.replaceChild(new_template, template);
Array.prototype.forEach.call(template.attributes, function(attribute) {
new_template.setAttribute(attribute.name, attribute.value);
});
for (var child; child = template.firstChild; new_template.content.appendChild(child));