Skip to content

Instantly share code, notes, and snippets.

View shmendo's full-sized avatar

Benjamin Walters shmendo

View GitHub Profile
@bendavis78
bendavis78 / svg-template-support.js
Last active April 23, 2022 19:54
Polymer 1.0 suppoert for template inside svg
// Templates inside SVG won't work in polymer-1.0 without some monkeypatching.
(function(){
var doc = document.currentScript.ownerDocument;
var root = doc.querySelector('dom-module > template').content;
var templates = root.querySelectorAll('svg template');
var el, template, attribs, attrib, count, child, content;
for (var i=0; i<templates.length; i++) {
el = templates[i];
template = el.ownerDocument.createElement('template');
el.parentNode.insertBefore(template, el);