Instead of
<!--
,
I used
<!-
…and it is working.
How?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Modern browser parsers (i.e. those that use the HTML5 parsing algorithm) work like this. If they are expecting text or a new tag next, and they see
<!then they check the next few characters to see if they are--orDOCTYPEor, if they are processing embedded SVG or MathML,[CDATA[. (See http://dev.w3.org/html5/spec/tokenization.html#markup-declaration-open-state)If, as in the case of
<!- foo, none of these match then the parser enters the bogus comment state where all the characters following, up to the next>, are read and and converted into a comment to be put into the DOM.Hence the behaviour you see with
<!-working like a comment start. Note that such behaviour is “repair” behaviour for broken markup and it’s wise not to rely on it.You can see how such markup forms a DOM here: Live DOM Viewer
Also note that this is different to what @Amber says. It is not treated as a tag in any meaningful sense, and it is certainly not ignored.