On Thu, Oct 24, 2013 at 1:29 PM, Anne van Kesteren <annevk@annevk.nl> wrote:
> On Thursday, October 24, 2013, Dimitri Glazkov wrote:
>
>> Woke up in the middle of the night and realized that throwing breaks
>> ShadowRoot.innerHTML (or we'll have to add new rules to hoist/drop text
>> nodes in parsing), which sounds bad.
>>
>
> innerHTML would end up re-throwing the same exception, unless you
> special-cased parsing. innerHTML throwing is somewhat unexpected though.
>
>
We don't really need to special case parsing. innerHTML works by parsing
into a DocumentFragment and then copying the nodes over from there, so we
can just silently drop them in the copy step or throw an exception.
Note that innerHTML can already throw an exception in XHTML/SVG documents
if the content is not well formed. Admittedly leaving some of the content
appended and throwing is somewhat confusing, but I think that's fine given
that once you get the text in there the API is full of sadness.
As a counter point appendChild(documentType) would throw an exception and
innerHTML silently drops if you do innerHTML = "<!DOCTYPE html>" (bogus
comment IIRC).
So perhaps dropping the text to avoid having authors deal with the
exception is best. I think we should do that.
- E