Closed Bug 9777 Opened 25 years ago Closed 25 years ago

Text::splitText() doesn't work when given Text::length

Categories

(Core :: DOM: Core & HTML, defect, P2)

x86
Linux
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: dbaron, Assigned: waqar)

References

()

Details

If you call textNode.splitText(textNode.length), it should leave the original
text node unchanged and should return an empty text node.  Right now it is
stopping JS execution (although it ought to throw an exception when
out-of-bounds):

http://www.fas.harvard.edu/~dbaron/dom/test/one-core-xml/Text
QA Contact: gerardok → ckritzer
Marking for beta, just because.
HTML DOM bugs are M11/P2 for Vidur.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
SplitText is returning the NS_DOM_INDEX_SIZE_ERR. This is the correct thing to
per DOM spec.
Status: RESOLVED → REOPENED
Reopening.  Now that exceptions are working, it should return that when the
argument is *greater than* length, but not when it is equal to length.  That was
the point of the bug.  To quote from the DOM1 spec:

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the
number of characters in data.

It's just as reasonable to pass Text::length as it is to pass 0 - both should
create one empty text node and one text node with all the text.
Resolution: INVALID → ---
In line 1 of previous comment, s/return that/throw INDEX_SIZE_ERR/
Assignee: vidur → waqar
Status: REOPENED → NEW
The fix is checked in and should be working in the next release.
*** Bug 16569 has been marked as a duplicate of this bug. ***
Status: NEW → RESOLVED
Closed: 25 years ago25 years ago
Resolution: --- → FIXED
dbaron, could you regress this bug?  The URL for this bug appears to no longer
be available.  I'll close this out on Wednesday unless I hear otherwise from
you.  Thanks!
Status: RESOLVED → VERIFIED
Verified fixed, Linux apprunner 1999-10-25-08-M11, including the bug marked as a
duplicate.  The URL seems fine to me.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.