function setup(root) { root.parts = {} root.querySelectorAll("[part-id]").forEach( element => { root.parts[element.getAttribute("part-id")] = element }) root.clone = function() { return setup(this.cloneNode(true)) } return root } function template(strings, ...args) { let buf = [] for (i=0;i