Closed
Bug 107753
Opened 23 years ago
Closed 23 years ago
Document's content duplicated when head element's content modified
Categories
(Core :: DOM: Editor, defect, P1)
Core
DOM: Editor
Tracking
()
VERIFIED
DUPLICATE
of bug 106383
People
(Reporter: glazou, Assigned: mozeditor)
Details
(Keywords: dataloss, regression, Whiteboard: EDITORBASE)
tested with win2k nightly build 20011030 from the .zip :
1) open a blank composer window
2) immediately switch to source view
3) replace the <br> by <p>foo</p><p>bar</p>
4) switch to preview mode
5) switch back to source view
6) AT THE END OF THE LINE below title element (notice the useless whitespaces),
enter <style> p { color : red }</style>
7) switch again to preview mode
The two paragraphs are duplicated !!!! Select all is uneffective, "Open new
composer page" is uneffective, etc...
Reporter | ||
Comment 1•23 years ago
|
||
Unable to reproduce the bug in ns6.2; I guess it is a regression.
Comment 2•23 years ago
|
||
You don't have to add a <style> tag to reproduce this bug. Removing the <br>
seems to be enough (and adding the <p> tags and maybe some other simple stuff).
This should be a high priority bug since it corrupts the users file!
Should this bug be reassigned to jfrancis or ?
Comment 3•23 years ago
|
||
Here's the code path:
nsHTMLEditor::RebuildDocumentFromSource()
...
res = SelectAll();
if (NS_FAILED(res)) return res;
...
res = LoadHTML(Substring(beginbody,endtotal));
Then in nsHTMLEditor::LoadHTMLWithCharset():
if (!isCollapsed)
{
res = DeleteSelection(eNone);
if (NS_FAILED(res)) return res;
}
So the reason for the double contents is because isCollapsed is true for this
test, and the existing contents are not deleted!
Tracing into SelectAll() reveals the cause in
nsTextEditRules::DocumentIsEmpty()
*aDocumentIsEmpty = (mBogusNode.get() != nsnull);
mBogusNode is not null.
Over to Joe.
Assignee: cmanske → jfrancis
Component: Editor: Composer → Editor: Core
Comment 4•23 years ago
|
||
SelectAll failing seems very important to me -- marking this EDITORBASE
Whiteboard: EDITORBASE
Comment 5•23 years ago
|
||
Since this is related to detecting when document is really empty, Kin pointed out
his work on bug 106383. Applying his preliminary patch for that problem fixes this,
so the basic problem is the same.
*** This bug has been marked as a duplicate of 106383 ***
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•