W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1998

Element.getElementsByTagName() question

From: Andrew M. Kuchling <akuchlin@cnri.reston.va.us>
Date: Mon, 12 Oct 1998 15:18:21 -0400 (EDT)
To: www-dom@w3.org
Message-ID: <13858.19977.285141.258163@amarok.cnri.reston.va.us>
In the spec, the getElementsByTagName() method of an Element node
"returns a NodeList of all descendant elements with a given tag name,
in the order in which they would be encountered in a preorder
traversal of the Element tree."  Presumably the element itself isn't
included in the resulting NodeList?  That is, after body =
doc.createElement('body'), body.getElementsByTagName('*') will return
an empty list, not a single-element list containing the body element.
Am I correct?

Another minor inconsistency that keeps tripping me up: Document nodes
have methods entitled createComment, createDocumentFragment,
createElement, which are all 'create' + an interface name.  But one
method is different: createTextNode(), where I'd expect createText().

A.M. Kuchling			http://starship.skyport.net/crew/amk/
It is unnecessary to understand electromagnetic theory before wiring a lamp or
to study physics in order to repair a pump. We count on our fingers and give
no heed to the proliferating implications of the act.
    -- James R. Newman
Received on Monday, 12 October 1998 15:18:23 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:04 UTC