Remove setup function from template.js

This commit is contained in:
Talia 2021-02-22 20:24:17 +01:00
parent 7e72b33325
commit f97ae06d3e
No known key found for this signature in database
GPG key ID: AD727AD22802D0D6

View file

@ -1,12 +1,3 @@
const 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
}
export const template = (strings, ...args) => { export const template = (strings, ...args) => {
let buf = [] let buf = []
for (i=0;i<strings.length;i++) { for (i=0;i<strings.length;i++) {
@ -14,5 +5,5 @@ export const template = (strings, ...args) => {
} }
let template = document.createElement("template") let template = document.createElement("template")
template.innerHTML = buf.join("") template.innerHTML = buf.join("")
return setup(template.content) return template.content
} }