W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2011

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

From: Benjamin Poulain <benjamin.poulain@nokia.com>
Date: Mon, 02 May 2011 12:13:14 +0200
Message-ID: <4DBE83BA.1070002@nokia.com>
To: public-webapps@w3.org
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:45 GMT