W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2006

[whatwg] parsing: bogus comments - PIs

From: Shadow2531 <shadow2531@gmail.com>
Date: Wed, 26 Jul 2006 21:45:59 -0400
Message-ID: <6b9c91b20607261845n30838af1o5d8b4c6f89ed3035@mail.gmail.com>
On 7/18/06, Ian Hickson <ian at hixie.ch> wrote:
> On Mon, 17 Jul 2006, Shadow2531 wrote:
> >
> > <? is a parse error and causes a switch to the bogus comment state.
> >
> > So, <?xml-stylesheet type="text/css" href=""?> is a bogus comment.
> > <http://whatwg.org/specs/web-apps/current-work/#bogus>
> >
> > "Emit a comment token whose data is the concatenation of all the
> > characters from the character that caused the state machine to switch
> > into the bogus comment state, up to the last consumed character before
> > the U+003E character..."
> >
> > I *was* 100% sure that the PI should be parsed into:
> >
> > <!--?xml-stylesheet type="text/css" href=""?-->
>
> Correct.

Thanks Ian. Can  you comment on innerHTML for this situation?

If <?xml-stylesheet type="text/css" href=""?> is parsed into
<!--?xml-stylesheet type="text/css" href=""?--> , what should
innerHTML show?

Currently, Gecko and KHTML ignore PIs in text/html, and don't add them
to the DOM. Plus, they don't show up in innerHTML.

Opera currently treats PIs as PIs in text/html and shows them as PI
markup with innerHTML. ( There's a tiny, already-filed bug with PIs
and innerHTML, but when the fix is applied, Opera will show
<?xml-stylesheet type="text/css" href=""?> again for the PI mentioned
here with innerHTML)

IE6 treats PIs as comments, which is good, but for innerHTML, IE6
shows the original markup of the PI instead of commented markup.

As you can see, there's nothing consistent across browsers with this
situation, but it seems that IE comes closest to HTML5.

I myself believe that if the PI is parsed into a bogus comment,
innerHTML should show comment markup as that's what it ends up being.
However, that would be incompatible with IE's innerHTML if that
matters.

What do you think?  I know innerHTML isn't yet defined, but this might
be a case where you, right now,  100% for sure,  know what must
happen.

Thanks

-- 
burnout426
Received on Wednesday, 26 July 2006 18:45:59 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:47 UTC