How can you retrieve all nodes within the selected range in javascript for example if i highlight the following nodes on this stackoverflow post is it possible to create a simple iterator given the base and extent node that walks the DOMTree between the two.

I've tried using Range and TreeWalker but haven't come up with anything i only ever get a range count of 1.