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:
@@ -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
|
||||
};
|
Reference in New Issue
Block a user