Click here to Skip to main content
15,888,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Assuming I dynamically create a paragraph and then create a text node and append it to the paragraph. It is easy enough to prove code wise the text node is a child of the paragraph. However, if I style (setAttribute) the text node before using appendChild to append it to the paragraph (e.g. Background color) are the attribute nodes children of the text node or children of the paragraph?

Thanks.
Posted
Comments
What you observed?
Dhaval Patel 17-Feb-14 5:30am    
First of all, attributes are not children of any node. Attributes and Children are two different thing. Any attribute assigned to any node(doesn't matter which node) will related to node itself.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900