fix(platform-server): support setting innerText property

Domino doesn't support innerText. So the actual inner text wasn't
getting set if the [innerText] was set on an element in a template. Add
it to the domino adapter to map it to textContent.

Also change wrongly named initParse5Adapter to initDominoAdapter.
This commit is contained in:
Vikram Subramanian
2017-09-09 15:12:13 -07:00
committed by Matias Niemelä
parent 9ab9437319
commit 831613aab5
3 changed files with 13 additions and 7 deletions

View File

@ -87,19 +87,25 @@ export class DominoAdapter extends BrowserDomAdapter {
isShadowRoot(node: any): boolean { return this.getShadowRoot(node) == node; }
getProperty(el: Element, name: string): any {
// Domino tries tp resolve href-s which we do not want. Just return the
// atribute value.
if (name === 'href') {
// Domino tries tp resolve href-s which we do not want. Just return the
// atribute value.
return this.getAttribute(el, 'href');
} else if (name === 'innerText') {
// Domino does not support innerText. Just map it to textContent.
return el.textContent;
}
return (<any>el)[name];
}
setProperty(el: Element, name: string, value: any) {
// Eventhough the server renderer reflects any properties to attributes
// map 'href' to atribute just to handle when setProperty is directly called.
if (name === 'href') {
// Eventhough the server renderer reflects any properties to attributes
// map 'href' to atribute just to handle when setProperty is directly called.
this.setAttribute(el, 'href', value);
} else if (name === 'innerText') {
// Domino does not support innerText. Just map it to textContent.
el.textContent = value;
}
(<any>el)[name] = value;
}