TreeWalker.nextNode() returns nodes outside the target subtree when no matches in subtree

RESOLVED DUPLICATE of bug 260293

Status

()

RESOLVED DUPLICATE of bug 260293
14 years ago
6 years ago

People

(Reporter: rcm, Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

When a TreeWalker is created over a subtree that contains no nodes matching the
whatToShow filter (e.g. SHOW_TEXT on a subtree with no text nodes in it), then
calling TreeWalker.nextNode() will exit the subtree and start returning matching
nodes from the rest of the document.

Correct behavior should be for nextNode() to return null, according to
http://www.w3.org/TR/DOM-Level-2-Traversal-Range/traversal.html#Traversal-TreeWalker


Reproducible: Always

Steps to Reproduce:
1. Go to the URL referenced in this bug report.  It contains some Javascript
that creates TreeWalkers and pops up their results in alert() dialogs.  

Actual Results:  
The alert dialogs show text and elements from the rest of the document,
indicating that TreeWalker.nextNode() blew past the desired subtree.

Expected Results:  
The alerts should be empty, showing that TreeWalker.nextNode() immediately
returned null.

*** This bug has been marked as a duplicate of 260293 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → DUPLICATE
Component: DOM: Traversal-Range → DOM: Core & HTML
Product: Core → Core
You need to log in before you can comment on or make changes to this bug.