feat(bootstraping): application bootstrapping implementation.
Entry-point to bootstrapping is a rootComponent. The bootstrapping method, uses the component's selector to find the insertion element in the DOM, and attaches the component in its ShadowRoot.
This commit is contained in:
@ -13,6 +13,9 @@ export class DOM {
|
||||
static query(selector) {
|
||||
return document.querySelector(selector);
|
||||
}
|
||||
static querySelector(el, selector:string):Node {
|
||||
return el.querySelector(selector);
|
||||
}
|
||||
static querySelectorAll(el, selector:string):NodeList {
|
||||
return el.querySelectorAll(selector);
|
||||
}
|
||||
@ -48,6 +51,9 @@ export class DOM {
|
||||
t.innerHTML = html;
|
||||
return t;
|
||||
}
|
||||
static createElement(tagName, doc=document) {
|
||||
return doc.createElement(tagName);
|
||||
}
|
||||
static clone(node:Node) {
|
||||
return node.cloneNode(true);
|
||||
}
|
||||
@ -84,4 +90,10 @@ export class DOM {
|
||||
static templateAwareRoot(el:Element):Node {
|
||||
return el instanceof TemplateElement ? el.content : el;
|
||||
}
|
||||
static createHtmlDocument() {
|
||||
return document.implementation.createHTMLDocument();
|
||||
}
|
||||
static defaultDoc() {
|
||||
return document;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user