Closed
Bug 45428
Opened 25 years ago
Closed 25 years ago
getElementsByTagName('*') does not find #text nodes
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
VERIFIED
INVALID
People
(Reporter: make, Assigned: jst)
Details
From Bugzilla Helper:
User-Agent: Mozilla/4.73 [en] (WinNT; U)
BuildID:
Calling getElementsByTagName('*') does not return any text nodes.
Reproducible: Always
Steps to Reproduce:
1. Create a document with at least one text node (this should not be to
difficult:)
2. Call getElementsByTagName and dump the nodeNames of the returned nodes.
Actual Results:
3. There will be no #text node.
Expected Results: From my understanding of the DOM(2) spec, I would expect to
be #text nodes included in the returned collection.
Page 33 reads... "tagname - The name of the tag to match on. The special value
"*" matches all tags."
Ok, one might discuss what _all tags_ exactly means. I think, a joker is joker
and it should return all nodes. Of course, I may be wrong.
Assignee | ||
Comment 1•25 years ago
|
||
The definition of the getElementsByTagName, as well as the name of the method
itself, says the getElementsByTagName() returns a list of *elements*, here's the
text from the DOM Level 2 spec:
"Returns a NodeList of all the Elements with a given tag name in the order in
which they are encountered in a preorder traversal of the Document tree"
Text nodes are *not* elements, only nodes that inherit the DOM Element interface
should be conciderd an element, IOW it will not return Documents, CDATASections,
Comment, ...
Marking INVALID
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 2•25 years ago
|
||
Thanks for correction and explanation.
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•