document.createDocumentFragment(html)

64 views
Skip to first unread message

Jake Verbaten

unread,
Nov 1, 2011, 8:45:16 AM11/1/11
to jquery-s...@googlegroups.com
Would there be any issue with changing

  DocumentFragment createDocumentFragment()

to

  DocumentFragment createDocumentFragment(optional DOMString validHtml)

with the functionality is basically run fragment parsing algorithm with the context element being the document if the validHtml string exists or just create a new document fragment.

How do you generally propose such ideas the the WHATWG / W3C ?




Robin Berjon

unread,
Nov 1, 2011, 12:33:48 PM11/1/11
to jquery-s...@googlegroups.com
On Nov 1, 2011, at 05:45 , Jake Verbaten wrote:
> Would there be any issue with changing
>
> DocumentFragment createDocumentFragment()
>
> to
>
> DocumentFragment createDocumentFragment(optional DOMString validHtml)
>
> with the functionality is basically run fragment parsing algorithm with the context element being the document if the validHtml string exists or just create a new document fragment.

I can see that being potentially useful indeed.

> How do you generally propose such ideas the the WHATWG / W3C ?

The first and most important thing is to write down the problem or use case that your proposal addresses (in this case, frequently written code that could be less complex and error-prone). Your chances of changing things are much higher with a clearly described problem and a bad solution proposal than with a great technical solution but poor reasons as to why it should exist in the first place.

The right place for such a proposal would be public-...@w3.org (http://lists.w3.org/Archives/Public/public-webapps/).

--
Robin Berjon
Robineko (http://robineko.com/)
Twitter: @robinberjon

Yehuda Katz

unread,
Nov 1, 2011, 2:25:40 PM11/1/11
to jquery-s...@googlegroups.com
In this case, you wouldn't want it to simply be as if it was inserted
in the document.

You would want something like this to work:

new DocumentFragment("<td>hi</td>")

even though tds are only allowed inside of a tr. This would
dramatically simplify code in libraries (like jQuery) that allow you
to create a DOM fragment from a String and insert it anywhere.

I would be interested in working with you to help develop this
proposal and put you in touch with the right folks.

Email me :)

Sent from my iPhone

Reply all
Reply to author
Forward
0 new messages