Exercise 1: Three "Self-Closing" Divs in a Row — Possible Solution ==================================================================== THE TEST ------------------------------ tokenize("
Hi") RESULT ------------------------------ [opentag('div', {}), opentag('div', {}), opentag('div', {}), text('Hi'), closetag('div'), closetag('div'), closetag('div')] kinds: ['opentag', 'opentag', 'opentag', 'text', 'closetag', 'closetag', 'closetag'] WHAT A REAL BROWSER WOULD RENDER ------------------------------ Three divs, genuinely nested three levels deep, with "Hi" as the content of the INNERMOST one -- not three empty, self-closed boxes sitting next to each other. Visually: a single block of text reading "Hi", wrapped by three levels of (by default, invisible) div containers, one inside the next. Nothing about the "/" characters changed anything about the final structure at all -- the markup behaves exactly as if it had been written "