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:
parent
ff9cb76ec2
commit
501ec7b37b
|
@ -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;
|
||||
|
|
Reference in New Issue