On Thu, 3 Nov 2011, Tim Down wrote:
Have you looked at the createContextualFragment() method of Range?http://html5.org/specs/dom-parsing.html#dom-range-createcontextualfragment
That doesn't meet the use case where you don't know the contextual element upfront. As I understand it that is important for some of the use cases.
I think this is possible to solve, but needs an extra mode in the parser. Also, createcontextualFragment could be modified to take null as the context to work in this mode.