0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Opera collapses blocks with just spaces for data

This commit is contained in:
Neil Jenkins 2011-12-09 13:30:58 +11:00
parent 14ee0d0ad5
commit cfe9bea8b3

View file

@ -385,8 +385,16 @@ implement( Element, {
}
el = child;
}
if ( el.isLeaf() && el.nodeType !== TEXT_NODE ) {
el.parentNode.insertBefore( doc.createTextNode( '' ), el );
if ( el.isLeaf() ) {
if ( el.nodeType !== TEXT_NODE ) {
el.parentNode.insertBefore(
doc.createTextNode( '' ), el );
}
// Opera will collapse the block element if it contains
// just spaces (but not if it contains no data at all).
else if ( /^ +$/.test( el.data ) ) {
el.data = '';
}
}
}
else if ( !el.querySelector( 'BR' ) ) {