Closed
Bug 25123
Opened 26 years ago
Closed 25 years ago
nsIDOMDocument::InsertBefore() can't be used to insert an element...
Categories
(Core :: DOM: Core & HTML, defect, P3)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
FIXED
M16
People
(Reporter: jst, Assigned: vidur)
Details
AFAI can tell from reading the DOM spec it should be possible to insert an
element into a document with Document::InsertBefore() or Document::AppendChild()
as long as there is no root element in the document. This is currently not
possible due to some incorrect code in nsIDocument::InsertBefore(), it checks if
the new node is a comment or PI, if it's not then InsertBefore() fails.
The correct behaviour here is IMO to allow element nodes as long as there is
no root element in the document, and also inserting text nodes should be
possible as long as the text in the node is whitespace only.
Coding the above is trivial but the effects in layout are at least to mee
currently unknown. This requires some investigating.
| Assignee | ||
Comment 1•26 years ago
|
||
The DOM spec doesn't allow creation of a document without a document element.
EIther way, it is still possible using internal methods to create such a
document. The suggestion seems reasonable and should apply to InsertBefore,
AppendChild and ReplaceChild. Marking M16.
Status: NEW → ASSIGNED
Target Milestone: M16
Comment 2•25 years ago
|
||
Any news on this? Right now, there's no way to construct a Document from
scratch, as one can only append/insert ProcessingInstruction, Comment or
DocumentType and these can't have children. This blocks us a bit for integration
of Transformiix (XSLT processor) into Mozilla. I've thought about using
nsDocument::SetRootContent(nsIContent* aRoot) for inserting a root element, but
this seems a bit of a kludge.
I haven't found where the DOM spec doesn't allow creation of a document without
a document element. Could you point me to that?
M16 has been out for a while now, these bugs target milestones need to be
updated.
Comment 4•25 years ago
|
||
This was fixed by Vidur as a side effect of his XML extras work, marking FIXED.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Updated•25 years ago
|
Component: DOM Level 1 → DOM Core
Comment 8•24 years ago
|
||
still fails and some of the bugs which were reported have been
futhered..marking this bug as verified as using the other bugs as reference ...
Status: RESOLVED → VERIFIED
Component: DOM: Core → DOM: Core & HTML
QA Contact: stummala → general
You need to log in
before you can comment on or make changes to this bug.
Description
•