Next Oct 27 PreviousElementary node stuff
Which of the following functions will create DOMElement objects. Choose all that apply.
A: createComment()
B: createElement()
C: createElementNS()
D: createTextNode()
Answer
All four functions return an object of type DOMNode but only B: createElement() and C: createElementNS() return DOMElements. Take a good look at this (incomplete) DOMNode inheritance tree, it should be second nature to you:
DOMNode
-
DOMAttr
DOMCharacterData
-
DOMDocument
DOMDocumentFragment
DOMDocumentType
DOMElement
DOMEntity
DOMEntityReference