Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 1572950

Browse files
committed
Merge pull request #291 from orthes/fix-performance
Fix performance
2 parents df2e796 + f7af9ac commit 1572950

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/js/core.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,7 @@
296296
return;
297297
}
298298

299-
// Fix #39
300-
// After deleting all content (ctrl+A and delete) in Firefox, all content is deleted and only <br> appears
301-
// To force placeholder to appear, set <p><br></p> as content of the $el
302-
303-
if (this.$el.html().trim() === '' || this.$el.html().trim() === '<br>') {
299+
if (this.$el.children().length === 0) {
304300
this.$el.html(this.templates['src/js/templates/core-empty-line.hbs']().trim());
305301
}
306302

@@ -309,7 +305,7 @@
309305
$text = this.$el
310306
.contents()
311307
.filter(function () {
312-
return this.nodeName === '#text' && $.trim($(this).text()) !== '';
308+
return (this.nodeName === '#text' && $.trim($(this).text()) !== '') || this.nodeName.toLowerCase() === 'br';
313309
});
314310

315311
$text.each(function () {

0 commit comments

Comments
 (0)