Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##Original HTML
- <a>link one is really really long <img src="img.png" /></a>
- <a>link two</a>
- <a>link three</a>
- <a>link four</a>
- ###Initialise
- Parse the HTML into DOM elements.
- __IF__ there is more than one root element, wrap them in a span element.
- <span>
- <a>link one is really really long <img src="img.png" /></a>
- <a>link two</a>
- <a>link three</a>
- <a>link four</a>
- </span>
- ###Phase 1
- __IF__ there is more than one child DOM element __THEN__ Remove the last DOM element. __GOTO__ [Measure](#measure)
- __ELSE IF__ the remaining child element itself has child elements __GOTO__ [Phase 1(child element)](#phase-1)
- __ELSE GOTO__ [Phase 2](#phase-2)
- <span>
- <a>link one is really really long <img src="img.png" /></a>
- <a>link two</a>
- <a>link three</a>
- </span>
- ###Phase 2
- Get the text content of the remaining DOM element and truncate at the last space.
- <span>
- <a>link one is really really</a>
- </span>
- __GOTO__ [Measure](#measure)
- ###Measure
- __IF__ the HTML height is overflowing the containing element __GOTO__ Current Phase
- __ELSE RETURN__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement