If you are talking about DOM ranges, the solution is to split the range around the node that you want to exclude, giving you two ranges.
var newRange = range.cloneRange();
range.setEndBefore(node);
newRange.setStartAfter(node);
This will not work in IE <= 8, which has a completely different way of representing ranges.
source
share