Spring Hire Sale
Limited Time Deal: Unlock all premium questions for over 30% off
$10.42$7.08
08
:
04
:
49
:
01
Back to Dashboard
DOM Leaf Text Comparison
Medium
A document renderer processes two hierarchical DOM structures and checks whether they produce identical rendered text. Each node in the DOM either holds a non-empty text value (leaf node) or holds child nodes (container node). Container nodes carry no text themselves.
Extract all leaf texts from each DOM tree by traversing top-to-bottom in pre-order, then concatenate them. Return true if both trees produce the same concatenated string, false otherwise.
...