diff --git a/packages/platform-server/src/domino_adapter.ts b/packages/platform-server/src/domino_adapter.ts index 0bbab8f1c7..8570aa91d4 100644 --- a/packages/platform-server/src/domino_adapter.ts +++ b/packages/platform-server/src/domino_adapter.ts @@ -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 (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; } (el)[name] = value; } diff --git a/packages/platform-server/src/server.ts b/packages/platform-server/src/server.ts index 46e447eb61..46dbd9707a 100644 --- a/packages/platform-server/src/server.ts +++ b/packages/platform-server/src/server.ts @@ -30,7 +30,7 @@ function notSupported(feature: string): Error { export const INTERNAL_SERVER_PLATFORM_PROVIDERS: StaticProvider[] = [ {provide: DOCUMENT, useFactory: _document, deps: [Injector]}, {provide: PLATFORM_ID, useValue: PLATFORM_SERVER_ID}, - {provide: PLATFORM_INITIALIZER, useFactory: initParse5Adapter, multi: true, deps: [Injector]}, { + {provide: PLATFORM_INITIALIZER, useFactory: initDominoAdapter, multi: true, deps: [Injector]}, { provide: PlatformLocation, useClass: ServerPlatformLocation, deps: [DOCUMENT, [Optional, INITIAL_CONFIG]] @@ -40,7 +40,7 @@ export const INTERNAL_SERVER_PLATFORM_PROVIDERS: StaticProvider[] = [ {provide: ALLOW_MULTIPLE_PLATFORMS, useValue: true} ]; -function initParse5Adapter(injector: Injector) { +function initDominoAdapter(injector: Injector) { return () => { DominoAdapter.makeCurrent(); }; } diff --git a/packages/platform-server/test/integration_spec.ts b/packages/platform-server/test/integration_spec.ts index b6a2a75d2e..132df6f585 100644 --- a/packages/platform-server/test/integration_spec.ts +++ b/packages/platform-server/test/integration_spec.ts @@ -426,7 +426,7 @@ export function main() { let doc: string; let called: boolean; let expectedOutput = - 'Works!

'; + 'Works!

fine

'; beforeEach(() => { // PlatformConfig takes in a parsed document so that it can be cached across requests.