fix(platform-server): handle innerText (#15818)
This commit is contained in:
parent
70b1d6dd9d
commit
9394835db4
@ -80,6 +80,8 @@ export class Parse5DomAdapter extends DomAdapter {
|
|||||||
setProperty(el: any, name: string, value: any) {
|
setProperty(el: any, name: string, value: any) {
|
||||||
if (name === 'innerHTML') {
|
if (name === 'innerHTML') {
|
||||||
this.setInnerHTML(el, value);
|
this.setInnerHTML(el, value);
|
||||||
|
} else if (name === 'innerText') {
|
||||||
|
this.setText(el, value);
|
||||||
} else if (name === 'className') {
|
} else if (name === 'className') {
|
||||||
el.attribs['class'] = el.className = value;
|
el.attribs['class'] = el.className = value;
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,15 +54,19 @@ class TitleApp {
|
|||||||
class TitleAppModule {
|
class TitleAppModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({selector: 'app', template: '{{text}}'})
|
@Component({selector: 'app', template: '{{text}}<h1 [innerText]="h1"></h1>'})
|
||||||
class MyAsyncServerApp {
|
class MyAsyncServerApp {
|
||||||
text = '';
|
text = '';
|
||||||
|
h1 = '';
|
||||||
|
|
||||||
@HostListener('window:scroll')
|
@HostListener('window:scroll')
|
||||||
track() { console.error('scroll'); }
|
track() { console.error('scroll'); }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
Promise.resolve(null).then(() => setTimeout(() => { this.text = 'Works!'; }, 10));
|
Promise.resolve(null).then(() => setTimeout(() => {
|
||||||
|
this.text = 'Works!';
|
||||||
|
this.h1 = 'fine';
|
||||||
|
}, 10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,7 +357,7 @@ export function main() {
|
|||||||
let doc: string;
|
let doc: string;
|
||||||
let called: boolean;
|
let called: boolean;
|
||||||
let expectedOutput =
|
let expectedOutput =
|
||||||
'<html><head></head><body><app ng-version="0.0.0-PLACEHOLDER">Works!</app></body></html>';
|
'<html><head></head><body><app ng-version="0.0.0-PLACEHOLDER">Works!<h1 innerText="fine">fine</h1></app></body></html>';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// PlatformConfig takes in a parsed document so that it can be cached across requests.
|
// PlatformConfig takes in a parsed document so that it can be cached across requests.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user