Remove setup function from template.js
This commit is contained in:
parent
7e72b33325
commit
f97ae06d3e
1 changed files with 1 additions and 10 deletions
11
template.js
11
template.js
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue