[whatwg] parsing: bogus comments - PIs

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