Log in

View Full Version : Resolved Enigmatic w3c Error



marain
03-12-2016, 09:15 PM
The following code
<br />
<br />


<!--




Your elected officials: Who are they? What do they do? How can you contact them? Enter your zip code and

click on &quot;GO!&quot; to find out. (Powered by FAMM--Families Against Mandatory Minimums.)
<br />
<br />
<center>
<script type="text/javascript">
src="http://ffs.capwiz.com/DHTML/CAjsform.js">
</script>
<form method="get" action="http://capwiz.com/stickers/" onsubmit="return verify(this);" target="_blank">
<input type="hidden" name="dir" value="famm" />
<input type="hidden" name="lvl" value="C" />
<table border="0" cellpadding="1" cellspacing="0" bgcolor="#000000">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100" bgcolor="#000000">
<tr>
<td align="center" colspan="2" bgcolor="#000000" valign="top">
<img src="images/contactcongress.gif" width="100" height="33" alt="marijuana lawyer NJ"/>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#000000"><input name="azip" size="5" value="" />
</td>
<td valign="middle"><input type="image" src="images/go.gif" name="Go" alt="NJ Marijuana Lawyer" />
</td>
</tr>
<tr>
<td valign="top" colspan="2" bgcolor="#FFFFFF">
<img src="images/capwiztxt.gif" alt="NJ Lawyer Marijuana Arrest" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<br />
</center>


-->


<font size="-2"><a href="http://www.njmarijuana.com/page.php?here=resources">Return to Top</a></font>gives the following error when validated in w3c:

Validation Output: 1 Error

Error Line 1722, Column 167: invalid comment declaration: found name start character outside comment but inside comment declaration

…GO!&quot; to find out. (Powered by FAMM--Families Against Mandatory Minimums.)


Info Line 1717, Column 1: comment declaration started here

<!--




I'm puzzled why something inside a comment is being flagged as an error. Actually, were it not inside a comment, I still don't see the error.

Suggestions?

A.

jscheuer1
03-13-2016, 02:25 AM
HTML 5?

That would be my guess anyway.

This is malformed as well:


<script type="text/javascript">
src="http://ffs.capwiz.com/DHTML/CAjsform.js">
</script>

Anyways, we really need to have a link to the page and know which specification you are validating to.

That said, anything that is validly within a comment tag SHOULD be able to be garbage, unless it prematurely exits that state (being a comment) and by doing so creates invalid markup and/or script code.

I've already seen though were according to the HTML 5 specification, things inside a javascript comment section within the bounds of a valid opening and closing script tag, have been misinterpreted to be invalid.

At that time the specification was still experimental, and maybe still is.

It's useful to know how to follow standards. However, many sites do not. As long as what you are doing is interpreted as you desire by all browsers you are targeting, that's enough.

And, in my opinion, sometimes the validator is wrong, or maybe is technically right, while missing a more basic fact which makes the error it's reporting superfluous.

Again, because those sort of cases can be tricky, if you want more help on this, please provide a link to the page so we can run it through the validator ourselves to see what's happening. Also, if the specification you are attempting to validate to isn't clearly indicated by the DOCTYPE of the page, please include which specification you are validating to as well.

marain
03-13-2016, 02:14 PM
Thank you for your analysis. Here is the URL:

http://www.njmarijuana.com/page.php?here=resources

A.

jscheuer1
03-13-2016, 05:29 PM
Well, technically, you got me. I'd say ignore it, OR - if it's very important to you that it validate, I think we can make a reasonable assumption that since it sees the:


--F

as the problem. Amd since -- is by convention an important part of both an opening and closing HTML comment, either change that to a single - or add a space before and (more importantly) after so it isn't seen to be working in conjunction with the F. I'm thinking that --F upsets it because it wants to see either --> or because --F would be valid if preceded by an opening F!--.

In any case, it's not hurting anything the way that it is, and to get it to validate, all you need do is make the --F not look like a malformed ending comment tag or an ending comment tag that has no opener. I can all but guarantee it's one of those two the validator is 'thinking' when it flags this. I'll check around a little, if I see a specific reference, I'll get back to you here. But for now, just try dropping one of the dashes. That, or decide to live with it.

OK, I just checked. It's technically invalid for -- to appear inside an HTML comment. Also, as further explanation, though it is popular to use HTML commenting to leave old code in place pending its eventual re-inclusion or final deletion, this is not the purpose of commenting. The purpose is to demarcate the structure of and explain the placement of elements within the document. Any other more extensive use runs the risk of creating invalid code as has happened in this case. Even with their strict limited intended use, HTML comments must follow certain basic rules to be valid.

Once again, in this case I think you can safely ignore it. At the same time - technically speaking you should either uncomment that block and use it, or just get rid of it.

marain
03-13-2016, 07:43 PM
I eliminated the -- and it now validates. Thank you.

Yes, its presence seemed to not hurt anything but, aesthetically, I do like clear validations. I am also under the impression that w3c flags can cause loss of "points" in the search engines. Admittedly, this flag was of the most minor variety. (It was seen as an error, though, and not a mere warning.)

Regardless, thanks again.

A.

jscheuer1
03-13-2016, 09:03 PM
Well, after I Googled it, I realized it technically is an error/invalid. I doubt any modern browser would 'barf' on it, but it will be taken into consideration wherever validation errors are counted. Another good reason to fix it is that it's an > from becoming a closing comment tag, one little typo to that effect will really mess up the page. So, in a sense best to err on the side of caution. Get rid of the "disaster waiting to happen".