A Bugzilla upgrade is planned starting at 18:30 UTC on 5 September 2013. Bugzilla may be unavailable for up to an hour while the upgrade takes place.
Bug 5132 - Inserted code when validating snippets has its own errors
: Inserted code when validating snippets has its own errors
Status: RESOLVED FIXED
Product: Validator
Classification: Unclassified
Component: check
: HEAD
: PC Windows XP
: P2 normal
: 0.8.6
Assigned To: Ville Skyttä
: qa-dev tracking
:
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-04 13:57 UTC by Ed Brandon
Modified: 2010-03-02 18:46 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Brandon 2007-10-04 13:57:40 UTC
Hi,

There seems to be a bug in the HTML validator.

I’m validating a snippet of HTML, so I’m using the Validate by Direct input tab, and furthermore have set the checkboxes in the more options to Validate HTML fragment and Use Doctype HTML 4.01.

The validator inserts code at the beginning and end to make a complete HTML document.  Unfortunately, the inserted code itself creates many errors!

This sure makes it hard to find the errors in one’s own snippet.

Kind regards,

Ed
Comment 1 Olivier Thereaux 2007-10-04 23:51:50 UTC
(In reply to comment #0)
> The validator inserts code at the beginning and end to make a complete HTML
> document.  Unfortunately, the inserted code itself creates many errors!

Not as far as I know. There may be incompatibilities with the code you are pasting in, could you give a sample?
Comment 2 Ed Brandon 2007-10-05 13:26:24 UTC
Thanks for replying.

I couldn't reproduce the error this morning, but believe I will be able to with a bit of trying.  I did get a clue as to the nature of the problem when I did try again this morning.

This combination did correctly detect an error in my code, since it used the strict Doctype.  I discovered that I could ask for the transitional doctype and all was well with my code.  This surprised me - I would have thought that with "Validate HTML fragment" checked, the 1st "Use Doctype" field (with the drop down list) would be ignored.

But this is the clue to help me reproduce the error - I'm sure I selected a different Doctype.

It's a long weekend in Canada, so I'll play with this at home to reproduce the error.  Please keep this one open until at least Tuesday.

Thanks!

Ed Brandon
Webmaster
Canadian Public Health Association
Comment 3 Ed Brandon 2007-10-12 12:08:27 UTC
Please send me an E-mail address I can send things to.
Comment 4 Olivier Thereaux 2008-01-17 06:42:08 UTC
(In reply to comment #3)
> Please send me an E-mail address I can send things to.

If you want to send code snippets, this bugzilla (use the attachment feature), or www-validator@w3.org would do. If this is something you'd rather not share publicly, you could send it to me only  but I suspect you can just remove whatever private info and send publicly, that would help the transparency in bug tracking.
Comment 5 Olivier Thereaux 2008-02-21 06:59:10 UTC
Ed, ping?

Without a test case, I am inclined to close this bug.
Comment 6 Ed Brandon 2008-02-22 15:28:22 UTC
Hi ot@w3.org,

I think I know what the problem is - it occurs only when testing code snippets.

Below is what I tried to validate:

--------------------------------

<h2>Resolutions &amp; Motions</h2>
<ul>
  <li><a href="2000s/2006/final06e.pdf">2006 resolutions</a> (PDF: 25k)</li>
  <li><a href="2000s/2004/final04e.pdf">2004 resolutions</a> (PDF: 74k)</li>
  <li><a href="2000s/2003/final03e.pdf">2003 resolutions</a> (PDF: 145k )</li>
  <li><a href="2000s/2002/res2002e.pdf">2002 resolutions</a> (PDF: 313k)</li>
  <li><a href="2000s/2001/final01e.pdf">2001 resolutions</a> (PDF: 272k)</li>
  <li><a href="2000s/2000/PPLC_2000_eng.pdf">2000 resolutions</a> (PDF: 201k)</li>
  <li><a href="1990s/list.htm#1999">1999 resolutions</a></li>
  <li><a href="1990s/list.htm#1998">1998 resolutions</a></li>
  <li><a href="2000s/2002/res2002e.pdf">1997 resolutions</a> (PDF: 142k)</li>
  <li><a href="2000s/2002/res2002e.pdf">1996 resolutions</a> (PDF: 106k)</li>
  <li><a href="2000s/2002/res2002e.pdf">1995 resolutions</a> (PDF: 109k)</li>
  <li><a href="archive.htm">Archives</a></li>
</ul>

--------------------------------

And below are the settings (I had expanded the more options button):

--------------------------------

Use Doctype: XHTML 1.0 transitional

BUT

Validate HTML fragment was selected.

It should have ignored the Use Doctype.

--------------------------------

I recall that this problem occurred by my bouncing back and forth between testing snippets and complete pages, and not changing the Use Doctype value setting.  IO believe this is a simple fix to make, to simply ignore this with code snippets.

Hope this helps

- Ed

Comment 7 Ville Skyttä 2009-09-21 20:42:36 UTC
That's right, the full document doctype should be ignored when validating a fragment wrapped in the chosen doctype template.  Fixed in CVS, will be in 0.8.6.
Comment 8 Ville Skyttä 2010-03-02 18:46:50 UTC
Fixed in 0.8.6.