Closed Bug 290262 Opened 20 years ago Closed 20 years ago

Midas editor undo breaks after HTML inserted through .innerHTML

Categories

(Core :: DOM: Editor, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 290261

People

(Reporter: derekdavenport, Assigned: mozeditor)

References

()

Details

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b2) Gecko/20050413 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b2) Gecko/20050413 Firefox/1.0+

This may be related to bug <a
href="https://bugzilla.mozilla.org/show_bug.cgi?id=116045">116045</a>.
After you use .innerHTML to insert HTML into a midas editor trying to use Undo
gives the following error:
Error: uncaught exception: [Exception... "Node was not found"  code: "8"
nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)"  location:
"http://www.mozilla.org/editor/midasdemo/ Line: 199"]
Note that editor.contentDocument.queryCommandEnabled("Undo") returns true.
After this trying to undo or redo gives this 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://www.mozilla.org/editor/midasdemo/ Line: 199"]

Reproducible: Always

Steps to Reproduce:
1. Visit midas demo
2. Type some text into the editor
3. Click "View HTML Source" checkbox twice (uses .innerHTML)
4. Click the undo button for first error
5. Click undo/redo for more errors

Actual Results:  
Exception thrown when you click undo
Subsequent exceptions on undo/redo commands

Expected Results:  
editor.contentDocument.queryCommandEnabled("Undo") should return false
undo command should do nothing
redo command should do nothing

*** This bug has been marked as a duplicate of 290261 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.