开发者

Can a DOM Range object end before it starts?

The DOM specification on Range objects doesn't address whether a range can have an end container/offset that comes befor开发者_Go百科e its start container/offset. The Mozilla docs on Range.setStart() indicate that this isn't allowed. Is this a Mozilla quirk, or common behaviour?


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜