Skip to content

Commit

Permalink
Use DOM node stack to immediately commit captured document history (i…
Browse files Browse the repository at this point in the history
…nstead of recording data post-traversal)
  • Loading branch information
[email protected] committed May 29, 2024
1 parent fe2d800 commit 88f0495
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion legiscope.nodejs/sp-test-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -1945,6 +1945,7 @@ async function monitor()
extant: p.found_data_id,
fetch: p.unfetched_data_id,
immed: p.child_hits > 0 && p.hit_depth > d && ( p.hit_depth == ( 3 + d ) ),
nodeId: node_id,
depth: d,
hitat: p.hit_depth
}, default_insp),
Expand Down Expand Up @@ -2616,6 +2617,10 @@ async function monitor()

// FIXME: Use sp.nodestack to look up the container of this
// [History] event trigger link
// TEST 1:
// Depth [d] is 1 greater than the key/index at the "top"
// of sp.nodestack.
// sp.nodestack[ d - 4 ] appears to be a usable target.

let tempmap = new Map;
sp.nodestack.forEach((v,k) => {
Expand All @@ -2635,11 +2640,23 @@ async function monitor()
extant: p.found_data_id,
fetch: p.unfetched_data_id,
immed: p.child_hits > 0 && p.hit_depth > d && ( p.hit_depth == ( 3 + d ) ),
nodeId: node_id,
depth: d,
hitat: p.hit_depth
}, default_insp),
inspect( tempmap, default_insp )
);

if ( sp.nodestack.has( d - 4 ) ) {
let candidate = sp.nodestack.get( d - 4 );
await congress_extract_write_history_panel(
sp,
candidate.node,
p,
candidate.nodeId,
d - 4
);
}
await sleep(2500);
}//}}}
nodes_seen.clear();
Expand All @@ -2658,7 +2675,7 @@ async function monitor()
}
// if ( nm.nodeName == '#text' && nm.content == '[History]' )
}//}}}
else if ( p.child_hits /*> 0 && p.traversal_rq_complete*/ /*p.hit_depth > d && ( p.hit_depth == ( 3 + d ) )*/ )
else if ( envSet("DEPRECATED_POSTORDER_TRAVERSE","1") && p.child_hits /*> 0 && p.traversal_rq_complete*/ /*p.hit_depth > d && ( p.hit_depth == ( 3 + d ) )*/ )
{//{{{
// FIXME: REMOVE THIS BLOCK
process.stdout.write( p.traversal_rq_complete ? '%' : '$');
Expand Down

0 comments on commit 88f0495

Please sign in to comment.