File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,20 @@ function init_hydrate(target: NodeEx) {
37
37
38
38
type NodeEx2 = NodeEx & { claim_order : number } ;
39
39
40
- // We know that all children have claim_order values since the unclaimed have been detached
41
- const children = Array . from ( target . childNodes as NodeListOf < NodeEx > ) . filter ( x => x . claim_order !== undefined ) as NodeEx2 [ ] ;
40
+ // We know that all children have claim_order values since the unclaimed have been detached if target is not head
41
+ let children : ArrayLike < NodeEx2 > = target . childNodes as NodeListOf < NodeEx2 > ;
42
+
43
+ // If target is head, there may be children without claim_order
44
+ if ( target . nodeName . toLowerCase ( ) == "head" ) {
45
+ const myChildren = [ ] ;
46
+ for ( let i = 0 ; i < children . length ; i ++ ) {
47
+ const node = children [ i ] ;
48
+ if ( node . claim_order !== undefined ) {
49
+ myChildren . push ( node )
50
+ }
51
+ }
52
+ children = myChildren ;
53
+ }
42
54
43
55
/*
44
56
* Reorder claimed children optimally.
You can’t perform that action at this time.
0 commit comments