Added template concept

This commit is contained in:
barsdeveloper
2021-10-10 13:52:13 +02:00
parent 84606486c4
commit 8ef5f3dab4
8 changed files with 320 additions and 232 deletions

22
js/template/Template.js Normal file
View File

@@ -0,0 +1,22 @@
export default class Template {
/**
* Computes the html content of the target element.
* @param {HTMLElement} element Target element
* @returns The computed html
*/
render(element) {
return ``
}
/**
* Returns the html elements rendered by this template.
* @param {HTMLElement} element Target element
* @returns The rendered elements
*/
getElements(element) {
let aDiv = document.createElement('div')
aDiv.innerHTML = this.render(element)
return aDiv.childNodes
}
}