[Webkit-unassigned] [Bug 110297] New: Make ComposedShadowTreeWalker's traversal member functions return the node.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Feb 19 21:08:48 PST 2013


https://bugs.webkit.org/show_bug.cgi?id=110297

           Summary: Make ComposedShadowTreeWalker's traversal member
                    functions return the node.
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: HTML DOM
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: hayato at chromium.org
                CC: darin at apple.com, rniwa at webkit.org,
                    webcomponents-bugzilla at chromium.org


The context is here:
https://lists.webkit.org/pipermail/webkit-dev/2013-February/023918.html

The same concern could be also applied to ComposedShadowTreeWalker.
IMO, omitting verb from the name of member functions might be okay in this context since it's used in the 'Walker' context. That's one of the naming choices as seen in TreeWalker's firstChild(), Java's iterataor's next() and so on.
The bad part is that each member function doesn't return the node. I am feeling that it is something strange and makes readers, including me, uncomfortable.

I'd like to improve APIs.

The current APIs (as for firstChild()):

  - void firstChild();  // This has a side effect. You should call walker.node() later to get the current node.
  - Node* node() const;

The candiates I am thinking are:

A)
  - Node* firstChild();   // This has a side effect. 
  - Node* node() const;

B)
  - Node* walkToFirstChild();   // This has a side effect.
  - Node* node() const;

C)
  - void walkToFirstChild();   // This has a side effect. You should call walker.node() later to get the current node.
  - Node* node() const;

Which is the best choice? Any other one? My current plan is A, which is similar to TreeWalker.
http://www.w3.org/TR/DOM-Level-2-Traversal-Range/traversal.html#TreeWalker

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list