File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,9 @@ class TreeWalker {
3939 if ( previousNode !== this . _rootNode ) {
4040 this . _path . push ( previousNode )
4141 }
42- } else if ( this . currentNode . nextSibling !== null && ! this . _path . includes ( this . currentNode . nextSibling ) ) {
42+ } else if ( this . currentNode . nextSibling !== null &&
43+ ( this . _rootBookmark === this . currentNode . parentNode || this . _path . includes ( this . currentNode . parentNode ) ) &&
44+ ! this . _path . includes ( this . currentNode . nextSibling ) ) {
4345 this . _path . push ( this . currentNode . nextSibling )
4446 this . _currentNode = this . currentNode . nextSibling
4547 } else {
Original file line number Diff line number Diff line change @@ -51,7 +51,6 @@ describe("treewalker", () => {
5151 assert . strictEqual ( nodeList [ 13 ] . textContent , "9" )
5252 assert . strictEqual ( nodeList [ 14 ] . textContent , "Test" )
5353
54-
5554 } )
5655
5756 it ( "nextNode_" , ( ) => {
@@ -96,6 +95,20 @@ describe("treewalker", () => {
9695
9796 } )
9897
98+ it ( "nextNode____" , ( ) => {
99+
100+ const bbDocument = Parser . parse ( "[quote]1[quote][/quote][quote][/quote][/quote]" )
101+
102+ let treeWalker = new TreeWalker ( bbDocument . documentElement . childNodes [ 0 ] . childNodes [ 1 ] )
103+ let nodeList = [ ]
104+ while ( treeWalker . nextNode ( ) ) {
105+ nodeList . push ( treeWalker . currentNode )
106+ }
107+ assert . strictEqual ( nodeList . length , 0 )
108+
109+
110+ } )
111+
99112 it ( "nextNodeList" , ( ) => {
100113
101114 const bbDocument = Parser . parse ( "[list][*]1[list][*]test[/list][*]2[*]3[*]4[/list]" )
You can’t perform that action at this time.
0 commit comments