Recently I found that there is, possibly, a new way of commenting in HTML5.
Instead of the typical <!-- -->
multi-line commenting I've read about, I thought I noticed that my IDE made a regular <!div >
commented out. So I tested it out, and to my surprise Chrome had commented out that tag. It only commented out the tag and not the contents of the div, so I had to comment out the closer <!/div>
to avoid closing other divs.
I tested another and it appears that generally putting an exclamation marker in front of the opening of any tag, this symbol <
, makes that tag commented out.
Is this actually new? Is it bad practice? It is actually very convenient, but is it practical yet(if not new)?
Edit extra details:
Although a syntax error or misinterpretations of this particular syntax is a good reason, how come Chrome actually renders them as full comments?
The code is written as:
<!div displayed> some text here that is still displayed <!/div>
And then it is rendered as:
<!--div displayed--> some text here that is still displayed <!--/div-->
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…