File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -24,15 +24,15 @@ func (n *Node) Ancestors() iter.Seq[*Node] {
2424 }
2525}
2626
27- // Children returns an iterator over the immediate children of n,
27+ // ChildNodes returns an iterator over the immediate children of n,
2828// starting with n.FirstChild.
2929//
3030// Example:
3131//
32- // for child := range n.Children () { ... }
32+ // for child := range n.ChildNodes () { ... }
3333//
3434// Mutating a Node or its children while iterating may have unexpected results.
35- func (n * Node ) Children () iter.Seq [* Node ] {
35+ func (n * Node ) ChildNodes () iter.Seq [* Node ] {
3636 _ = n .FirstChild // eager nil check
3737
3838 return func (yield func (* Node ) bool ) {
@@ -59,7 +59,7 @@ func (n *Node) Descendants() iter.Seq[*Node] {
5959}
6060
6161func (n * Node ) descendants (yield func (* Node ) bool ) bool {
62- for c := range n .Children () {
62+ for c := range n .ChildNodes () {
6363 if ! yield (c ) || ! c .descendants (yield ) {
6464 return false
6565 }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import (
1111 "testing"
1212)
1313
14- func TestNode_Children (t * testing.T ) {
14+ func TestNode_ChildNodes (t * testing.T ) {
1515 tests := []struct {
1616 in string
1717 want string
@@ -32,11 +32,11 @@ func TestNode_Children(t *testing.T) {
3232 // Drill to <html><head></head><body>
3333 n := doc .FirstChild .FirstChild .NextSibling
3434 var results []string
35- for c := range n .Children () {
35+ for c := range n .ChildNodes () {
3636 results = append (results , c .Data )
3737 }
3838 if got := strings .Join (results , " " ); got != test .want {
39- t .Errorf ("unexpected children yielded by Children ; want: %q got: %q" , test .want , got )
39+ t .Errorf ("unexpected children yielded by ChildNodes ; want: %q got: %q" , test .want , got )
4040 }
4141 }
4242}
You can’t perform that action at this time.
0 commit comments