0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 07:13:08 -05:00

Always return nodeAfterSplit from split fn

This commit is contained in:
Neil Jenkins 2013-04-10 13:43:31 +10:00
parent 77b0b6c716
commit 20f92c9785
3 changed files with 5 additions and 11 deletions

View file

@ -348,10 +348,7 @@ function fixCursor ( node ) {
function split ( node, offset, stopNode ) {
var nodeType = node.nodeType,
parent, clone, next;
if ( nodeType === TEXT_NODE ) {
if ( node === stopNode ) {
return offset;
}
if ( nodeType === TEXT_NODE && node !== stopNode ) {
return split( node.parentNode, node.splitText( offset ), stopNode );
}
if ( nodeType === ELEMENT_NODE ) {
@ -391,7 +388,7 @@ function split ( node, offset, stopNode ) {
// Keep on splitting up the tree
return split( parent, clone, stopNode );
}
return node;
return offset;
}
function mergeInlines ( node, range ) {

File diff suppressed because one or more lines are too long

View file

@ -219,10 +219,7 @@ function fixCursor ( node ) {
function split ( node, offset, stopNode ) {
var nodeType = node.nodeType,
parent, clone, next;
if ( nodeType === TEXT_NODE ) {
if ( node === stopNode ) {
return offset;
}
if ( nodeType === TEXT_NODE && node !== stopNode ) {
return split( node.parentNode, node.splitText( offset ), stopNode );
}
if ( nodeType === ELEMENT_NODE ) {
@ -262,7 +259,7 @@ function split ( node, offset, stopNode ) {
// Keep on splitting up the tree
return split( parent, clone, stopNode );
}
return node;
return offset;
}
function mergeInlines ( node, range ) {