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 {
39
39
if ( previousNode !== this . _rootNode ) {
40
40
this . _path . push ( previousNode )
41
41
}
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 ) ) {
43
45
this . _path . push ( this . currentNode . nextSibling )
44
46
this . _currentNode = this . currentNode . nextSibling
45
47
} else {
Original file line number Diff line number Diff line change @@ -51,7 +51,6 @@ describe("treewalker", () => {
51
51
assert . strictEqual ( nodeList [ 13 ] . textContent , "9" )
52
52
assert . strictEqual ( nodeList [ 14 ] . textContent , "Test" )
53
53
54
-
55
54
} )
56
55
57
56
it ( "nextNode_" , ( ) => {
@@ -96,6 +95,20 @@ describe("treewalker", () => {
96
95
97
96
} )
98
97
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
+
99
112
it ( "nextNodeList" , ( ) => {
100
113
101
114
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