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

Fix off-by-one error trimming white space.

This commit is contained in:
Neil Jenkins 2014-04-30 15:15:54 +10:00
parent 996a0dd672
commit 76b482b41f
3 changed files with 7 additions and 7 deletions

View file

@ -2410,11 +2410,11 @@ var cleanTree = function ( node, allowStyles ) {
} }
} }
if ( i + 1 === l || !isInline( children[ i + 1 ] ) ) { if ( i + 1 === l || !isInline( children[ i + 1 ] ) ) {
j = ll - 1; j = ll;
while ( j >= 0 && !notWS.test( data.charAt( j ) ) ) { while ( j > 0 && !notWS.test( data.charAt( j - 1 ) ) ) {
j -= 1; j -= 1;
} }
if ( j < ll - 1 ) { if ( j < ll ) {
child.data = data.slice( 0, j ); child.data = data.slice( 0, j );
} }
} }

File diff suppressed because one or more lines are too long

View file

@ -1348,11 +1348,11 @@ var cleanTree = function ( node, allowStyles ) {
} }
} }
if ( i + 1 === l || !isInline( children[ i + 1 ] ) ) { if ( i + 1 === l || !isInline( children[ i + 1 ] ) ) {
j = ll - 1; j = ll;
while ( j >= 0 && !notWS.test( data.charAt( j ) ) ) { while ( j > 0 && !notWS.test( data.charAt( j - 1 ) ) ) {
j -= 1; j -= 1;
} }
if ( j < ll - 1 ) { if ( j < ll ) {
child.data = data.slice( 0, j ); child.data = data.slice( 0, j );
} }
} }