diff --git a/demos/playground/playground.js b/demos/playground/playground.js index c6ca9152e0..6ebe626d92 100644 --- a/demos/playground/playground.js +++ b/demos/playground/playground.js @@ -37,7 +37,7 @@ app = function () { // Set initial content for the "editor" // this.$editor.html("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.... New text..."); - this.$editor.html("New book is good"); + this.$editor.html("Ipsum New book message is good Lorem"); // this.$editor.html("... w"); this.$editor.addClass('leafNode'); @@ -98,7 +98,7 @@ app.prototype.loopFunc = function() { } else { var sameFromLeft = 0, sameFromRight = 0, - l = Math.max( this.prevText.length, text.length ); + l = text.length > this.prevText.length ? this.prevText.length : text.length; while ( sameFromLeft < l && this.prevText[sameFromLeft] == text[sameFromLeft] ) { ++sameFromLeft; @@ -107,6 +107,8 @@ app.prototype.loopFunc = function() { while ( sameFromRight < l && this.prevText[this.prevText.length - 1 - sameFromRight] == text[text.length - 1 - sameFromRight] ) { ++sameFromRight; } + console.log('sameFromLeft', sameFromLeft); + console.log('sameFromRight', sameFromRight); console.log('to delete', this.prevText.substring( sameFromLeft, this.prevText.length - sameFromRight), sameFromLeft ); console.log('to insert', text.substring( sameFromLeft, text.length - sameFromRight ), sameFromLeft ); } @@ -114,6 +116,7 @@ app.prototype.loopFunc = function() { } if ( hash !== this.prevHash ) { + console.log("DOM hash is different"); this.prevHash = hash; }