Uncaught exception, when using surroundContents with a portion of a TextOnly Document!

RESOLVED DUPLICATE of bug 135928

Status

()

Core
DOM: Core & HTML
--
major
RESOLVED DUPLICATE of bug 135928
15 years ago
5 years ago

People

(Reporter: C.Kleinhuis, Unassigned)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20030925
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20030925

a document, constisting of
<body>
bla bla bla some text
</body>
and a range starting at the last "bla" to "some" 
when using  
sel.getRangeAt(0).surroundContents(Some_NODE);
i get the following error:
Error: uncaught exception: [Exception... "Index or size is negative or greater
than the allowed amount"  code: "1" nsresult: "0x80530001
(NS_ERROR_DOM_INDEX_SIZE_ERR)"  location:
"http://cms/imperia/jscript/htmleditor/htmleditor_scripts_v2.js Line: 274"]




Reproducible: Always

Steps to Reproduce:
1. Create a html document with ONLY TEXT 
2. Select Some text
3. execute the following javascript code in the location bar:
javascript:window.getSelection().getRangeAt(0).surroundContents(document.createElement("A"))

Actual Results:  
i got an uncaught exception, 
Error: uncaught exception: [Exception... "Index or size is negative or greater
than the allowed amount"  code: "1" nsresult: "0x80530001
(NS_ERROR_DOM_INDEX_SIZE_ERR)"  location:
"javascript:window.getSelection().getRangeAt(0).surroundContents(document.createElement("A"))
Line: 1"]

Expected Results:  
It should have surrounded the selected text node with the "A" tag, so that it is
now a LINK !
Not Javascript.
Assignee: rogerl → traversal-range
Component: JavaScript Engine → DOM Traversal-Range
QA Contact: PhilSchwartau → ian

*** This bug has been marked as a duplicate of 135928 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → DUPLICATE
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.