Added a new ability to specify a slot for child elements of a IgniteElement to be placed in. Next up is a reconstruct method, which may or may not be possible, not sure.

This commit is contained in:
2020-07-28 22:46:22 -07:00
parent 43962757f0
commit 374defdc82
4 changed files with 41 additions and 4 deletions

View File

@@ -375,10 +375,34 @@ class property extends IgniteTemplate {
}
}
class slot extends IgniteTemplate {
constructor(element) {
super(null);
this.parent = element;
}
construct(parent, sibling) {
if (!this.element) {
this.element = window.document.createTextNode("");
if (sibling) {
parent.insertBefore(this.element, sibling);
} else {
parent.appendChild(this.element);
}
//Add any slot elements after this element.
this.parent.elements.forEach((item) => this.element.parentElement.insertBefore(item, this.element));
}
}
}
export {
IgniteTemplate,
div,
html,
list,
a
a,
slot
};