mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-03 05:00:13 -05:00
Don't clean nodes that are already clean
This commit is contained in:
parent
241cd64227
commit
96e3243007
3 changed files with 28 additions and 21 deletions
|
@ -1752,20 +1752,24 @@ var replaceStyles = function ( node, parent ) {
|
|||
css = style[ attr ];
|
||||
if ( css && converter.regexp.test( css ) ) {
|
||||
el = converter.replace( doc, css );
|
||||
if ( newTreeBottom ) {
|
||||
newTreeBottom.appendChild( el );
|
||||
}
|
||||
newTreeBottom = el;
|
||||
if ( !newTreeTop ) {
|
||||
newTreeTop = el;
|
||||
//No need to clean node that is already clean
|
||||
if(el.style.cssText !== style.cssText) {
|
||||
if ( newTreeBottom ) {
|
||||
newTreeBottom.appendChild( el );
|
||||
}
|
||||
newTreeBottom = el;
|
||||
if ( !newTreeTop ) {
|
||||
newTreeTop = el;
|
||||
}
|
||||
|
||||
node.style[ attr ] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( newTreeTop ) {
|
||||
newTreeBottom.appendChild( empty( node ) );
|
||||
node.innerHTML = '';
|
||||
node.appendChild( newTreeTop );
|
||||
newTreeBottom.appendChild( node.cloneNode(true) );
|
||||
parent.replaceChild( newTreeTop, node );
|
||||
}
|
||||
|
||||
return newTreeBottom || node;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -86,20 +86,24 @@ var replaceStyles = function ( node, parent ) {
|
|||
css = style[ attr ];
|
||||
if ( css && converter.regexp.test( css ) ) {
|
||||
el = converter.replace( doc, css );
|
||||
if ( newTreeBottom ) {
|
||||
newTreeBottom.appendChild( el );
|
||||
}
|
||||
newTreeBottom = el;
|
||||
if ( !newTreeTop ) {
|
||||
newTreeTop = el;
|
||||
//No need to clean node that is already clean
|
||||
if(el.style.cssText !== style.cssText) {
|
||||
if ( newTreeBottom ) {
|
||||
newTreeBottom.appendChild( el );
|
||||
}
|
||||
newTreeBottom = el;
|
||||
if ( !newTreeTop ) {
|
||||
newTreeTop = el;
|
||||
}
|
||||
|
||||
node.style[ attr ] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( newTreeTop ) {
|
||||
newTreeBottom.appendChild( empty( node ) );
|
||||
node.innerHTML = '';
|
||||
node.appendChild( newTreeTop );
|
||||
newTreeBottom.appendChild( node.cloneNode(true) );
|
||||
parent.replaceChild( newTreeTop, node );
|
||||
}
|
||||
|
||||
return newTreeBottom || node;
|
||||
|
|
Loading…
Reference in a new issue