Closed Bug 161012 Opened 23 years ago Closed 23 years ago

previousSibling(), nextSibling(), parentNode() on Traversal returns null.

Categories

(Core :: DOM: Core & HTML, defect, P3)

x86
All
defect

Tracking

()

VERIFIED INVALID

People

(Reporter: stummala, Assigned: anthonyd)

Details

(Keywords: testcase)

Attachments

(2 files)

BuildID: 2002-07-31-08 when the following methods are used on treewalker, null is returned. var walker = document.createTreeWalker(_NODE_, NodeFilter.SHOW_ELEMENT, null, false); alert (walker.parentNode()); //returns null alert (walker.nextSibling()); //returns null alert (walker.previousSibling()); //returns null Reproducible: Always Steps to Reproduce: 1.Load the testcase. Actual Results: null null null Expected Results: [object HTMLDivElement] [object HTMLSpanElement] [object Text]
Attached file testcase
adding testcase keyword and changing myself as QA contact
Keywords: testcase
Priority: -- → P3
QA Contact: lchiang → stummala
Attached file Fixed testcase
The original testcase has a few issues with it: 1) You're trying to walk to siblings and parents of the root of the treewalker's view of the document. It can't do that (that would take it out of the subtree it's allowed ib), so it must return null. See the description of the parentNode() function in http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/traversal.html#Traversal-TreeWalker 2) Even if you _could_ move to the parents and siblings of the <br>, you can't have parentNode() return the <div> while nextSibling() returns the <span> right after that. The reason is that parentNode() adjusts the current node to point to the <div>, which pretty clearly has no nextSibling. 3) previousSibling() from the <br> cannot be the #text node because you have NodeFilter.SHOW_ELEMENT set. #text nodes are not elements.
Marking invalid, but please reopen if the corrected testcase is misbehaving in some way I missed... Nice testcase, by the way (the diagram was very helpful!)
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
catching up on verifications
Status: RESOLVED → VERIFIED
Component: DOM: Traversal-Range → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: