Skip to content

Commit

Permalink
use innerHTML in updateInput() function only once to improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
linkesch committed Mar 25, 2016
1 parent 5d52829 commit cb0cdbf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/js/events.js
Expand Up @@ -391,12 +391,14 @@
}
// An event triggered which signifies that the user may have changed someting
// Look in our cache of input for the contenteditables to see if something changed
var index = target.getAttribute('medium-editor-index');
if (target.innerHTML !== this.contentCache[index]) {
var index = target.getAttribute('medium-editor-index'),
html = target.innerHTML;

if (html !== this.contentCache[index]) {
// The content has changed since the last time we checked, fire the event
this.triggerCustomEvent('editableInput', eventObj, target);
}
this.contentCache[index] = target.innerHTML;
this.contentCache[index] = html;
},

handleDocumentSelectionChange: function (event) {
Expand Down

0 comments on commit cb0cdbf

Please sign in to comment.