Skip to content
This repository was archived by the owner on May 7, 2021. It is now read-only.

Commit 4d262cb

Browse files
jarifibrahimjoshuawilson
authored andcommitted
fix(markdown): Ensure fieldEmpty get correct value on chrome and firefox (#153)
1 parent b378247 commit 4d262cb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/app/markdown/markdown.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,9 @@ export class MarkdownComponent implements OnChanges, OnInit, AfterViewChecked {
269269
}
270270

271271
editorKeyUp(event: Event) {
272-
this.fieldEmpty =
273-
event.srcElement.textContent.trim() === '';
272+
// Do not use this.event.srcElement. The "event" object is not consistent
273+
// across browsers. Chrome has event.srcElement while firefox has event.originalTarget.
274+
this.fieldEmpty = this.editorInput.nativeElement.innerText.trim() === '';
274275
}
275276

276277
closeClick() {

0 commit comments

Comments
 (0)