mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Fix Range#containsNode.
Not sufficient for node to be adjacent to range; must actually contain range.
This commit is contained in:
parent
953ee3bfc7
commit
e8a917f321
2 changed files with 4 additions and 6 deletions
|
@ -107,8 +107,6 @@ implement( Text, {
|
|||
getLength: function () {
|
||||
return this.length;
|
||||
},
|
||||
// The text node is essentially its own contents.
|
||||
empty: function () { return this; },
|
||||
isLike: function ( node ) {
|
||||
return node.nodeType === TEXT_NODE;
|
||||
},
|
||||
|
|
|
@ -238,18 +238,18 @@ implement( Range, {
|
|||
// Node must not finish before range starts or start after range
|
||||
// finishes.
|
||||
var nodeEndBeforeStart = ( range.compareBoundaryPoints(
|
||||
END_TO_START, nodeRange ) === 1 ),
|
||||
END_TO_START, nodeRange ) > -1 ),
|
||||
nodeStartAfterEnd = ( range.compareBoundaryPoints(
|
||||
START_TO_END, nodeRange ) === -1 );
|
||||
START_TO_END, nodeRange ) < 1 );
|
||||
return ( !nodeEndBeforeStart && !nodeStartAfterEnd );
|
||||
}
|
||||
else {
|
||||
// Node must start after range starts and finish before range
|
||||
// finishes
|
||||
var nodeStartAfterStart = ( range.compareBoundaryPoints(
|
||||
START_TO_START, nodeRange ) === -1 ),
|
||||
START_TO_START, nodeRange ) < 1 ),
|
||||
nodeEndBeforeEnd = ( range.compareBoundaryPoints(
|
||||
END_TO_END, nodeRange ) === 1 );
|
||||
END_TO_END, nodeRange ) > -1 );
|
||||
return ( nodeStartAfterStart && nodeEndBeforeEnd );
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue