Re: [webcomponents]: Allowing text children of ShadowRoot is a bad time

On Tue, Oct 29, 2013 at 4:20 AM, Anne van Kesteren <annevk@annevk.nl> wrote:

> On Tue, Oct 29, 2013 at 7:34 AM, Simon Pieters <simonp@opera.com> wrote:
> > On Tue, 29 Oct 2013 00:54:05 +0100, Anne van Kesteren <annevk@annevk.nl>
> > wrote:
> >> We are considering not throwing in XML.
> >
> > Only on getting innerHTML, though, right?
>
> Oh I missed that. In that case throwing if you include text nodes for
> ShadowRoot nodes is not too bad. And would match what happens if you
> append a DocumentFragment that contains them which is the same
> operation. Sounds good.
>

I've been pondering this more recently and I think we want to just silently
drop the Text nodes instead. If you do
shadowRoot.appendChild(template.contents) and the author did:

<template>
  <div>header</div>
  <div>content</div>
</template>

We're going to throw an exception for all the Text between the elements
which is not really what the author wanted (or realized they were doing).

If dropping them is too gross we might want to just consider this a lost
cause and warn authors away from putting text in there due to the issues I
outlined in my original email.

- E

Received on Tuesday, 7 January 2014 22:43:34 UTC