HTML Comment Behavior -
So, when I saw the Magento WYSIWYG editor (all things) revolving around, then & lt ;! & Gt;
& lt ;! ---- & gt; As a result of
renders in HTML it seems that & lt ;! & Gt;
provides a generic ! & Lt ;! - [string] - & gt;
Comment I have tested this in Chrome only, but this behavior seems a little strange to me, as well as a little document on MDN. Neither gave me an answer, I could literally wrap my head around, though; Comment What is the importance of open delimiter ("-") , and if it is omitted, then & lt ;! & Gt; Always a proper comment? Could this, perhaps, my browser just get rid of invalid markup? Why not
& lt ;! & Gt;
Just rendered as text? I know it is not important, or is appropriate for doing anything, but I'm just curious!
Formally, the comment syntax in HTML is HTML complicated, after the SGML standard, but practice HTML was not implemented as a SGML application, an old page by WWDG briefly summarizes the HTML comment syntax and creates some practical notes on it. In practice, a comment and
-> Should end with
. It has been formally made in XHTML and HTML 5
But the browser has implemented comment syntax more generously, so that you can call them & lt ;! Start with
and & gt;
is not official and causes an error message from an HTML5 validator.) It is described and defined as necessary browser behavior in HTML 5 parsing rules, see Section 8.2.4.45, which defines How will the "bogus comment state" be recorded?
As such, & lt;! Foo & gt;
Works really (and creates a comment node in the DOM), but it is restricted in XHTML and HTML 5.
Comments
Post a Comment