[whatwg] [html5] bogus comment state

Ian Hickson ian at hixie.ch
Thu Jan 5 11:39:44 PST 2006

On Thu, 5 Jan 2006, Anne van Kesteren wrote:
> [http://whatwg.org/specs/web-apps/current-work/#bogus]
> I haven't had time to investigate it fully (like inspecting the real DOM in the
> three browsers I was testing on). It seems that Internet Explorer presevers the
> nodes in some way (when looking at the innerHTML).

Yeah, IE creates empty element nodes for element tag names it doesn't 
recognise. This leads to amusing things like tags called "/foo".

> It shows like a processing instruction though, not a comment. Firefox 
> simply drops all processing instructions (or bogus comments) and you can 
> not retrieve them in any way. Opera stores them in some quirky way. When 
> looking at the innerHTML of the page I get things like: |<? 
> target="test" content=""/>?>| for a processing instruction which looked 
> like: |<? test>|. We'll fix that sometime when it gets more important 
> and when it is clear what we're supposed to do.

The current proposal is to treat them like a simple comment. We could 
treat them like a PI but that would require even more error states, since 
we'd then have to distinguish </ foo > and <? foo > (spaces intentional).

Note that treating them as comments still leaves room for changes later as 
we can just say that <? ... > is treated specially if we want to -- 
changing the comment node to a PI node, e.g. -- without breaking older 

On Thu, 5 Jan 2006, Alexey Feldgendler wrote:
> Before changing the way how Opera handles it, some way of behavior 
> should be standardized.

Anne was referring to the current proposal in the spec:


> To me, it seems reasonable to drop invalid constructs like <? test>.

I agree. I think treating them as comments is better though.

On Fri, 6 Jan 2006, Lachlan Hunt wrote:
> That's not an invalid construct in HTML4,

It's not a conformant construct, though.

> it's a perfectly valid SGML processing instruction (it would not be 
> well-formed in XML, however). It's just not at all well supported and 
> has no defined meaning so it seems that something sensible will need to 
> be defined for handling it in HTML5.

Indeed. See the current proposal for one possibility.

The current proposal is just a straw man, by the way. It, as everything 
else in the draft, is very open to change.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list