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:
Rado Kirov
2014-11-07 14:30:04 -08:00
parent f0d6464856
commit 1221857d17
8 changed files with 271 additions and 7 deletions

View File

@ -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;
}
}