setStart() and setEnd() throw exception

VERIFIED DUPLICATE of bug 205635

Status

()

Core
DOM: Core & HTML
VERIFIED DUPLICATE of bug 205635
13 years ago
5 years ago

People

(Reporter: surkov, Unassigned)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20050821 Firefox/1.6a1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20050821 Firefox/1.6a1

If just setted start position is greater than current end then
nsIRange::setStart() throws an exception. Method nsIRange::setEnd() has 
the same behaviour. Specs says: "The start position of a Range is guaranteed to
never be after the end position. To enforce this restriction, if the start is
set to be at a position after the end, the Range is collapsed to that position.
Similarly, if the end is set to be at a position before the start, the Range is
collapsed to that position."

http://lxr.mozilla.org/mozilla/source/content/base/src/nsRange.cpp

nsIRange::setStart()
965     // the start must be before the end
966     if (!IsIncreasing(aParent, aOffset, mEndParent, mEndOffset)) {
967       return NS_ERROR_ILLEGAL_VALUE;
968     }

nsIRange::setEnd()
1018   // start must be before end
1019   if (mIsPositioned &&
!IsIncreasing(mStartParent,mStartOffset,theParent,aOffset))
1020     return NS_ERROR_ILLEGAL_VALUE;.

Reproducible: Always

Comment 1

13 years ago

*** This bug has been marked as a duplicate of 205635 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → DUPLICATE
(Reporter)

Updated

13 years ago
Status: RESOLVED → VERIFIED
Component: DOM: Traversal-Range → DOM: Core & HTML
Product: Core → Core
You need to log in before you can comment on or make changes to this bug.