refactor(core): move Meta methods that only have one version from DomAdapter (#32408)

PR Close #32408
This commit is contained in:
Kara Erickson
2019-08-30 12:52:48 -07:00
committed by Miško Hevery
parent 1a7c79746d
commit 89434e09c2
28 changed files with 88 additions and 111 deletions

View File

@ -78,7 +78,7 @@ export class DominoAdapter extends BrowserDomAdapter {
if (name === 'href') {
// Domino tries to resolve href-s which we do not want. Just return the
// attribute value.
return this.getAttribute(el, 'href');
return el.getAttribute('href');
} else if (name === 'innerText') {
// Domino does not support innerText. Just map it to textContent.
return el.textContent;

View File

@ -88,7 +88,7 @@ class DefaultServerRenderer2 implements Renderer2 {
return doc.createTextNode(value);
}
appendChild(parent: any, newChild: any): void { getDOM().appendChild(parent, newChild); }
appendChild(parent: any, newChild: any): void { parent.appendChild(newChild); }
insertBefore(parent: any, newChild: any, refChild: any): void {
if (parent) {
@ -126,7 +126,7 @@ class DefaultServerRenderer2 implements Renderer2 {
if (namespace) {
el.setAttributeNS(NAMESPACE_URIS[namespace], namespace + ':' + name, value);
} else {
getDOM().setAttribute(el, name, value);
el.setAttribute(name, value);
}
}

View File

@ -18,7 +18,7 @@ export class ServerStylesHost extends SharedStylesHost {
@Inject(DOCUMENT) private doc: any,
@Optional() @Inject(ɵTRANSITION_ID) private transitionId: string) {
super();
this.head = getDOM().getElementsByTagName(doc, 'head')[0];
this.head = doc.getElementsByTagName('head')[0];
}
private _addStyle(style: string): void {
@ -26,9 +26,9 @@ export class ServerStylesHost extends SharedStylesHost {
const el = adapter.createElement('style');
el.textContent = style;
if (!!this.transitionId) {
adapter.setAttribute(el, 'ng-transition', this.transitionId);
el.setAttribute('ng-transition', this.transitionId);
}
adapter.appendChild(this.head, el);
this.head.appendChild(el);
}
onStylesAdded(additions: Set<string>) { additions.forEach(style => this._addStyle(style)); }