@ -9,7 +9,7 @@
|
||||
import {DOCUMENT, ɵgetDOM as getDOM} from '@angular/common';
|
||||
import {DomElementSchemaRegistry} from '@angular/compiler';
|
||||
import {Inject, Injectable, NgZone, Renderer2, RendererFactory2, RendererStyleFlags2, RendererType2, ViewEncapsulation} from '@angular/core';
|
||||
import {EventManager, ɵNAMESPACE_URIS as NAMESPACE_URIS, ɵSharedStylesHost as SharedStylesHost, ɵflattenStyles as flattenStyles, ɵshimContentAttribute as shimContentAttribute, ɵshimHostAttribute as shimHostAttribute} from '@angular/platform-browser';
|
||||
import {EventManager, ɵflattenStyles as flattenStyles, ɵNAMESPACE_URIS as NAMESPACE_URIS, ɵSharedStylesHost as SharedStylesHost, ɵshimContentAttribute as shimContentAttribute, ɵshimHostAttribute as shimHostAttribute} from '@angular/platform-browser';
|
||||
|
||||
const EMPTY_ARRAY: any[] = [];
|
||||
|
||||
@ -90,7 +90,9 @@ class DefaultServerRenderer2 implements Renderer2 {
|
||||
return doc.createTextNode(value);
|
||||
}
|
||||
|
||||
appendChild(parent: any, newChild: any): void { parent.appendChild(newChild); }
|
||||
appendChild(parent: any, newChild: any): void {
|
||||
parent.appendChild(newChild);
|
||||
}
|
||||
|
||||
insertBefore(parent: any, newChild: any, refChild: any): void {
|
||||
if (parent) {
|
||||
@ -120,9 +122,13 @@ class DefaultServerRenderer2 implements Renderer2 {
|
||||
return el;
|
||||
}
|
||||
|
||||
parentNode(node: any): any { return node.parentNode; }
|
||||
parentNode(node: any): any {
|
||||
return node.parentNode;
|
||||
}
|
||||
|
||||
nextSibling(node: any): any { return node.nextSibling; }
|
||||
nextSibling(node: any): any {
|
||||
return node.nextSibling;
|
||||
}
|
||||
|
||||
setAttribute(el: any, name: string, value: string, namespace?: string): void {
|
||||
if (namespace) {
|
||||
@ -144,9 +150,13 @@ class DefaultServerRenderer2 implements Renderer2 {
|
||||
}
|
||||
}
|
||||
|
||||
addClass(el: any, name: string): void { el.classList.add(name); }
|
||||
addClass(el: any, name: string): void {
|
||||
el.classList.add(name);
|
||||
}
|
||||
|
||||
removeClass(el: any, name: string): void { el.classList.remove(name); }
|
||||
removeClass(el: any, name: string): void {
|
||||
el.classList.remove(name);
|
||||
}
|
||||
|
||||
setStyle(el: any, style: string, value: any, flags: RendererStyleFlags2): void {
|
||||
style = style.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
||||
@ -189,7 +199,9 @@ class DefaultServerRenderer2 implements Renderer2 {
|
||||
}
|
||||
}
|
||||
|
||||
setValue(node: any, value: string): void { node.textContent = value; }
|
||||
setValue(node: any, value: string): void {
|
||||
node.textContent = value;
|
||||
}
|
||||
|
||||
listen(
|
||||
target: 'document'|'window'|'body'|any, eventName: string,
|
||||
@ -200,7 +212,7 @@ class DefaultServerRenderer2 implements Renderer2 {
|
||||
target, eventName, this.decoratePreventDefault(callback));
|
||||
}
|
||||
return <() => void>this.eventManager.addEventListener(
|
||||
target, eventName, this.decoratePreventDefault(callback)) as() => void;
|
||||
target, eventName, this.decoratePreventDefault(callback)) as () => void;
|
||||
}
|
||||
|
||||
private decoratePreventDefault(eventHandler: Function): Function {
|
||||
@ -227,8 +239,8 @@ class DefaultServerRenderer2 implements Renderer2 {
|
||||
const AT_CHARCODE = '@'.charCodeAt(0);
|
||||
function checkNoSyntheticProp(name: string, nameKind: string) {
|
||||
if (name.charCodeAt(0) === AT_CHARCODE) {
|
||||
throw new Error(
|
||||
`Found the synthetic ${nameKind} ${name}. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application.`);
|
||||
throw new Error(`Found the synthetic ${nameKind} ${
|
||||
name}. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application.`);
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,7 +261,9 @@ class EmulatedEncapsulationServerRenderer2 extends DefaultServerRenderer2 {
|
||||
this.hostAttr = shimHostAttribute(componentId);
|
||||
}
|
||||
|
||||
applyToHost(element: any) { super.setAttribute(element, this.hostAttr, ''); }
|
||||
applyToHost(element: any) {
|
||||
super.setAttribute(element, this.hostAttr, '');
|
||||
}
|
||||
|
||||
createElement(parent: any, name: string): Element {
|
||||
const el = super.createElement(parent, name, this.document);
|
||||
|
Reference in New Issue
Block a user