Re: paste events and HTML support - interest in exposing a DOM tree?

On 05/02/2011 04:50 AM, ext Hallvord R. M. Steen wrote:
> event.clipboardData.getDocumentFragment()
>
> which would return a parsed and when applicable sanitized view of any
> markup the implementation supports from the clipboard. Rich text editors
> could now use normal DOM methods to dig through the contents and
> remove/add cruft as they wish on the returned document fragment, before
> doing an appendChild() and preventing the event's default action.

For me, this problem looks very similar to the common pattern of getting 
HTML fragment out of XHR response.

I think a general solution for parsing fragments would be better than 
this kind of special function only available through the clipboard.

Mozilla has some good tools for this kind of problems: 
https://developer.mozilla.org/en/Code_snippets/HTML_to_DOM

I would enjoy seeing a standard solution like this for the issue :)

cheers,
Benjamin

Received on Monday, 2 May 2011 10:42:16 UTC