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:
parent
f9cb71a666
commit
ca5c08e4d0
3 changed files with 9 additions and 3 deletions
|
@ -2405,7 +2405,10 @@ var cleanTree = function ( node, allowStyles ) {
|
||||||
} else {
|
} else {
|
||||||
if ( nodeType === TEXT_NODE ) {
|
if ( nodeType === TEXT_NODE ) {
|
||||||
data = child.data;
|
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;
|
j = 0;
|
||||||
ll = data.length;
|
ll = data.length;
|
||||||
if ( !i || !isInline( children[ i - 1 ] ) ) {
|
if ( !i || !isInline( children[ i - 1 ] ) ) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1343,7 +1343,10 @@ var cleanTree = function ( node, allowStyles ) {
|
||||||
} else {
|
} else {
|
||||||
if ( nodeType === TEXT_NODE ) {
|
if ( nodeType === TEXT_NODE ) {
|
||||||
data = child.data;
|
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;
|
j = 0;
|
||||||
ll = data.length;
|
ll = data.length;
|
||||||
if ( !i || !isInline( children[ i - 1 ] ) ) {
|
if ( !i || !isInline( children[ i - 1 ] ) ) {
|
||||||
|
|
Loading…
Reference in a new issue