RL******@comcast.net (Richard) wrote in message news:<32**************************@posting.google. com>...
From the W3C specs on HTML comments:
"White space is not permitted between the markup declaration open
delimiter("<!") and the comment open delimiter ("--"), but is
permitted between the comment close delimiter ("--") and the markup
declaration close delimiter (">"). A common error is to include a
string of hyphens ("---") within a comment. Authors should avoid
putting two or more adjacent hyphens inside comments."
"Information that appears between comments has no special meaning
(e.g., character references are not interpreted as such)."
"Note that comments are markup."
The first paragraph has a clue: the markup declaration close delimiter
(">").
Also from the W3C specs, this time from the definition of Attributes:
"Attribute/value pairs appear before the final ">" of an element's
start tag. "
<html
xmlns="http://www.w3.org/1999/xhtml" <!-- Comment 1 -->
xmlns:xf="http://www.w3.org/2002/xforms/cr" <!-- Comment 2 -->
When the parser hit the first "-->", it saw the "--" as the end of the
comment and interpreted the ">" as the closing the "html" element.
I see this as being similar to overlapping other tags, like:
<b <em>Hello</em>> there</b>
The browser may not choke, but one thing is for sure: do not count on
predicting the behavior. Put another way, do not put comments inside
of the opening "<" and closing ">" of any element.
By the way, stepping through a debugger and looking at the DOM
representation of your example shows clearly that it closed the HTML
element with the ">" from the first comment. The second xmlns
attribute was not present and the second comment ended up in the
<head>. FWIW
Code Ronin
-- Have Keyboard, Will Travel