Closed Bug 474255 Opened 14 years ago Closed 12 years ago

Editor "bogus node" not cleared on DOM changes

Categories

(Core :: DOM: Editor, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: roc, Assigned: ehsan.akhgari)

References

Details

(Whiteboard: [fixed by bug 611182])

If I have an empty document and make the body editable, say by setting designmode to true, then I set the body's innerHTML to something non-empty, then I try to do something like cmd_deleteCharForward that calls nsTextEditRules::WillDeleteSelection, nothing happens because mBogusNode has not been cleared.
Dupe of 232791?
Maybe 232791 should be duped to this bug, since my comment has more information.
Similarly, if you have a <textarea> or text <input> you can QI to nsIDOMNSEditableElement, get a hold of it's editor property, call GetRoot on the editor, and set innerHTML on the anonymous DIV, which leads to incorrect results.

Setting innerHTML means the editor gets cut out of the loop entirely: it's observers don't get the appropriate modifications, and the editor's texteditrules doesn't get to perform the appropriate pre/post-processing, which includes sorting out the bogus node etc.

I'm guessing nsGenericHTMLElement::SetInnerHTML would need to check to see if the element or something in the parent chain is either an anonymous div or an element with designmode = true, and if so use the editor's API for making the changes rather than appending the new document fragment directly.

However, AFAICT, although the editor keeps a reference to the root node of the content being edited, the node has no reference to the editor...
The best thing to do here would be to get rid of the bogus node completely.
This is fixed by bug 611182.
Assignee: nobody → ehsan
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [fixed by bug 611182]
You need to log in before you can comment on or make changes to this bug.