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

Fix bug in deleting all.

This commit is contained in:
Neil Jenkins 2011-11-02 11:54:58 +11:00
parent 110568350b
commit 1d5b841860

View file

@ -120,7 +120,7 @@ implement( Range, {
var startBlock = this.getStartBlock(),
endBlock = this.getEndBlock();
if ( startBlock !== endBlock ) {
if ( startBlock && endBlock && startBlock !== endBlock ) {
startBlock.mergeWithBlock( endBlock, this );
}
@ -336,8 +336,7 @@ implement( Range, {
}
if ( !node.isBlock() ) {
node = node.getPreviousBlock() ||
this.startContainer.ownerDocument
.body.getNextBlock();
this.startContainer.ownerDocument.body.getNextBlock();
}
return node;
},
@ -354,10 +353,12 @@ implement( Range, {
while ( node && !node.nextSibling ) {
node = node.parentNode;
}
return node ?
node.nextSibling.getPreviousBlock() :
this.startContainer.ownerDocument
.body.lastChild.getPreviousBlock();
if ( node ) {
node = node.nextSibling.getPreviousBlock();
} else {
node = this.startContainer.ownerDocument.body.lastChild;
if ( node ) { node = node.getPreviousBlock(); }
}
}
return node;
},