0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-01-03 05:00:13 -05:00

Cleanup nbsp-only text nodes.

This commit is contained in:
Neil Jenkins 2014-05-20 17:47:02 +10:00
parent f9cb71a666
commit ca5c08e4d0
3 changed files with 9 additions and 3 deletions

View file

@ -2405,7 +2405,10 @@ var cleanTree = function ( node, allowStyles ) {
} else {
if ( nodeType === TEXT_NODE ) {
data = child.data;
if ( notWS.test( data ) ) {
// Use \S instead of notWS, because we want to remove nodes
// which are just nbsp, in order to cleanup <div>nbsp<br></div>
// construct.
if ( /\S/.test( data ) ) {
j = 0;
ll = data.length;
if ( !i || !isInline( children[ i - 1 ] ) ) {

File diff suppressed because one or more lines are too long

View file

@ -1343,7 +1343,10 @@ var cleanTree = function ( node, allowStyles ) {
} else {
if ( nodeType === TEXT_NODE ) {
data = child.data;
if ( notWS.test( data ) ) {
// Use \S instead of notWS, because we want to remove nodes
// which are just nbsp, in order to cleanup <div>nbsp<br></div>
// construct.
if ( /\S/.test( data ) ) {
j = 0;
ll = data.length;
if ( !i || !isInline( children[ i - 1 ] ) ) {