@@ -63,12 +63,14 @@ export class ViewUtil {
6363
6464 if ( previous ) {
6565 previous . nextSibling = child ;
66+ child . previousSibling = previous ;
6667 } else {
6768 parent . firstChild = child ;
6869 }
6970
7071 if ( next ) {
7172 child . nextSibling = next ;
73+ next . previousSibling = child ;
7274 } else {
7375 this . appendToQueue ( parent , child ) ;
7476 }
@@ -81,6 +83,7 @@ export class ViewUtil {
8183
8284 if ( parent . lastChild ) {
8385 parent . lastChild . nextSibling = view ;
86+ view . previousSibling = parent . lastChild ;
8487 }
8588
8689 parent . lastChild = view ;
@@ -152,23 +155,28 @@ export class ViewUtil {
152155 parent . firstChild = null ;
153156 parent . lastChild = null ;
154157 child . nextSibling = null ;
158+ child . previousSibling = null ;
155159 return ;
156160 }
157161
158162 if ( parent . firstChild === child ) {
159163 parent . firstChild = child . nextSibling ;
160164 }
161165
162- const previous = this . findPreviousElement ( parent , child ) ;
166+ const previous = child . previousSibling ;
163167 if ( parent . lastChild === child ) {
164168 parent . lastChild = previous ;
165169 }
166170
167171 if ( previous ) {
168172 previous . nextSibling = child . nextSibling ;
173+ if ( child . nextSibling ) {
174+ child . nextSibling . previousSibling = previous ;
175+ }
169176 }
170177
171178 child . nextSibling = null ;
179+ child . previousSibling = null ;
172180 }
173181
174182 // NOTE: This one is O(n) - use carefully
0 commit comments