witten
/
luminotes
Archived
1
0
Fork 0

Fixes a problem where Editor.dirty() returned true spuriously in Firefox, even when nothing was changed.

The bug arose because Firefox shows br tags as "<br>" even when they are
initially "<br />". This meant that the initial and current html didn't match
up, so dirty() returned true even though nothing had changed.

In IE, there's a similar problem because IE likes to uppercase all tags. That
will be fixed in a subsequent commit.
This commit is contained in:
Dan Helfman 2008-05-17 16:16:27 -07:00
parent ff9cb76ec2
commit 501ec7b37b
1 changed files with 6 additions and 1 deletions

View File

@ -709,7 +709,12 @@ Editor.prototype.summarize = function () {
}
Editor.prototype.dirty = function () {
if ( this.document.body.innerHTML == this.initial_text )
// the replace() calls here cause the comparison to ignore difference between, for instance,
// "<br>" and "<br />"
var original_html = this.initial_text.replace( /\s*\/>/g, ">" );
var current_html = this.document.body.innerHTML.replace( /\s*\/>/g, ">" );
if ( current_html == original_html )
return false;
return true;