The DOM specification on Range objects doesn't address whether a range can have an end container/offset that comes before its start container/offset. The Mozilla docs on Range.setStart() indicate that this isn't allowed. Is this a Mozilla quirk, or common behaviour?
+2
A:
No, the end of a Range
cannot come before the start. This is common to all browsers that support Range and is implicit in the DOM specification.
However, selection objects can be "backwards". You can check this using the anchorNode
, anchorOffset
, focusNode
and focusOffset
properties of selections (except, of course, in IE).
Tim Down
2010-01-11 09:33:22