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

On Tue, Jan 7, 2014 at 2:59 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> On Tue, Jan 7, 2014 at 2:42 PM, Elliott Sprehn <esprehn@gmail.com> wrote:
> > 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.
>
> Alternately: silently drop whitespace, but still throw on significant text?
>

And have textNode.textContent or nodeValue throw an exception if you try to
make it into a non-whitespace node? That could work.

- E

Received on Wednesday, 8 January 2014 09:02:34 UTC