Re: new DOM4 insertions methods and return values

On Wed, Jan 16, 2013 at 1:26 AM, Anne van Kesteren <annevk@annevk.nl> wrote:

> On Wed, Jan 16, 2013 at 1:52 AM, Jake Verbaten <raynos2@gmail.com> wrote:
> > It would be useful if append returned either the single node or a
> > DocumentFragment
>
> The weird thing with doing this is that it would require the creation
> of a DocumentFragment (the specification calls for it too, but it does
> not need to be implemented that way currently). If no argument is
> passed, should we return null? Does remove() remain void?
>
>
I personally only care for a return value of the first element picked up by
the mutation macro. So if no elements are picked up by the mutation macro
it's fine to return null. It would make sense for remove to return itself.

If multiple values are passed then you can do one of a view things. Either
return an array of all those values, return null, return the first value or
return the document fragment created by the mutation macro. I don't know
what would be the best thing to do in this case.


>
> > ```js
> > var style = document.head.append(
> >   document.createElement("style"))
> >
> > style.type = "text/css"
> > style.textContent = "..."
> > ```
>
> Why is the type attribute still set? I see this for <script> sometimes
> too and it seems so weird. Is there some old browser that requires it?
>

That's just me making the example more obvious and verbose.


>
>
> --
> http://annevankesteren.nl/
>

Received on Wednesday, 16 January 2013 10:29:14 UTC