Added deconstruct functionality and cleanup code so that everything gets correctly cleaned up once a element is removed from the DOM. Added a new property template that allows properties to be used as content or html anywhere within a template's children. Next up is slot support.

This commit is contained in:
2020-07-28 22:23:49 -07:00
parent 1adb844c97
commit 43962757f0
5 changed files with 255 additions and 54 deletions

View File

@ -8,9 +8,10 @@ class Sheet extends IgniteElement {
this.show = false;
this.items = [];
this.href = "www.google.com";
this.name = "default content";
}
properties() {
get properties() {
return [
"show",
"name",
@ -26,10 +27,9 @@ class Sheet extends IgniteElement {
new div(
new html("<h2>this is before</h2>"),
new list(this.items, (item) => {
return new a(`${item}`).attribute("href", this.href)
return new a(this.name).attribute("href", this.href)
}),
new html("<h2>this is after</h2>"),
new a("this is a link").attribute("href", this.href)
new html("<h2>this is after</h2>")
)
);
}