Attr appendChild, insertBefore, removeChild, replaceChild fail




18 years ago
5 years ago


(Reporter: bc, Unassigned)


(Depends on: 1 bug, {dom1})

Windows 2000
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)




18 years ago
Attr may have Text or EntityReference Nodes as children.  When using any of the
appendChild, insertBefore, removeChild, replaceChild methods a
DOM_NO_MODIFICATION_ALLOWED_ERR exception is thrown no matter what.

To reproduce, visit the above URL using a recent build of Mozilla, select the
tc_catt504 test case and press submit.  In the left frame you can view the setup
steps (creating the nodes used), and the results of executing the test case. Due
to a scrollbar bug, you will have to click on the right frame and use the
keyboard to navigate through the report.

I will attach simplified testcases as soon as I can.
Known problem, could even be a dup. --> Future.
Target Milestone: --- → Future
Keywords: dom1
Component: DOM Level 1 → DOM Core

Comment 2

18 years ago
QA contact Update
QA Contact: janc → desale

Comment 3

18 years ago
Updating QA contact to Shivakiran Tummala.
QA Contact: desale → stummala

Comment 4

18 years ago
This doesn't even come close to working in Mozilla 0.9.3 on MacOS 9.1. 

I just ran through the DOM HTML Level 2 Conformance tests made available by
Netscape.  The test is called "tc_hatt504 Test Attribute children".  Mozilla
0.9.3 for Mac failed every single part of this test, including
Node.insertBefore, appendChild, removeChild and replaceChild.

The Netscape test is available here:

If this link doesn't work for you, try clicking on the "DOM HTML Level 2
Conformance Test on this page:

Comment 5

17 years ago
Some of these are working, some not (replaceChild). Will there be any movement
here soon?

Comment 6

17 years ago
Yes. See Jonas Sicking's last comment in bug 104219. Not too soon unfortunately :-(
Even if our attribute code soon can cope with this we'll still need to work on
our entity code to expose what we need from the parser, I wouldn't hold my
breath here...

Comment 8

17 years ago
This appears to be causing Moz to fail one of the tests in the w3c DOM test suite:

The test ECMAscript/tests/attrsetvaluenomodificationallowederrEE.html barfs, with 

[Exception... "Component returned failure code: 0x80004003
(NS_ERROR_INVALID_POINTER) [nsIDOMElement.appendChild]"  nsresult: "0x80004003
location: "JS frame ::
file:///C:/bugzilla/w3c_dom_core/ecmascript/tests/alltests.html ::
attrsetvaluenomodificationallowederrEE_runTest :: line 624"  data: no]"

Blocks: 125665


17 years ago
Keywords: mozilla1.0

Comment 9

17 years ago
-> eapp per oracle
Blocks: 125136
Whiteboard: [eapp]

Comment 10

17 years ago
remove eapp
No longer blocks: 125136
Whiteboard: [eapp]
Mass-reassigning bugs to
Assignee: jst → dom_bugs

Comment 12

14 years ago
So if I understand this right, I have to do the following to fix this bug

- I need to implement appendChild, etc in nsDOMAttribute class.
- Have appendChild, insertBefore, etc call appropriate functions in
- Implement those functions in nsAttributeChildList

Does this look right? If it does, then I have the following questions

- Is there a standard Vector or List data structure that I can use instead of
implementing my own in nsAttributeChildList.

Comment 13

13 years ago
My old mindspring account is long ago and far away. Updating URL. Select
tc_catt504. You can also run:

QA Contact: stummala → ian
I don't really have a good grasp on what's expected behavior for this bug.  I'm also not able to find the testcases bc points us to for Attr.*Child or Attr.insertBefore.

Comment 16

13 years ago
For the record, there are some very basic tests which use Attr.appendChild in bug 345700 (to be committed within the next few days, depending on when I have free time ).  Whenever this is fixed, the test code there should be enabled so that this functionality can be tested there.
When this is fixed the code in nsNodeUtils::CloneAndAdopt should be updated (it has a comment about which block to remove).


11 years ago
Duplicate of this bug: 421769

Comment 19

11 years ago
currently we throw NS_ERROR_NOT_IMPLEMENTED
 instead of NS_ERROR_DOM_HIERARCHY_REQUEST_ERR as expected in


10 years ago
Component: DOM: Core → DOM: Core & HTML
QA Contact: ian → general
Depends on: 611787
Duplicate of this bug: 547798
This shouldn't work per spec, and we won't make it work.
Last Resolved: 5 years ago
Resolution: --- → INVALID
Assignee: general → nobody

Comment 22

5 years ago

In XML, where the value of an attribute can contain entity references, the child nodes of the Attr node may be either Text or EntityReference nodes 

While html attributes don't have children, xml attributes do, so this isn't invalid. If it is not worth fixing, just say so.

For what it's worth, Chrome does allow you to append text children to either html or xml attributes and we now throw HierarchyRequestError.
You need to log in before you can comment on or make changes to this bug.