HTML Comment Question |
HTML Comment Question |
ACB |
Oct 10 2008, 02:09 PM
Post
#1
|
Group: Members Posts: 2 Joined: 10-October 08 Member No.: 6,865 |
I have a question regarding an HTML comment.
I visited http://htmlhelp.com/reference/wilbur/misc/comment.html and understand the rules about hyphens, but I have a question about empty comments. <!> is a valid comment, but is something such as <!<example> valid? This type of comment is being auto generated on occasion and is causing some trouble for my HTML comment removal script. Thank you for your help. |
Darin McGrew |
Oct 10 2008, 02:57 PM
Post
#2
|
WDG Member Group: Root Admin Posts: 8,365 Joined: 4-August 06 From: Mountain View, CA Member No.: 3 |
No, <!<example> is not a valid comment.
The easy rule is in the FAQ entry: QUOTE An HTML comment begins with "<!--", ends with "-->", and does not contain "--" or ">" anywhere in the comment. If you want to get technical, then as the HTML comments page of our Wilbur (HTML 3.2) guide explains: QUOTE A comment declaration starts with <!, followed by zero or more comments, followed by >. A comment starts and ends with "--", and does not contain any occurrence of "--". So <!> is a valid comment. But anything other than whitespace between the ! and the > must be a comment, which means it starts with -- and ends with -- and doesn't contain any other -- <! --<example--> would be a valid comment. But without any -- before and after, <!<example> is not a valid comment. |
ACB |
Oct 10 2008, 03:22 PM
Post
#3
|
Group: Members Posts: 2 Joined: 10-October 08 Member No.: 6,865 |
Thank you for your response.
|
Lo-Fi Version | Time is now: 23rd April 2024 - 09:47 PM |