Fossil

View Ticket
Login

View Ticket

Ticket Hash: 5ff2043c966820498ce41c0dd425b4b2155fa025
Title: Invalid xhtml markup generated (with patch)
Status: Fixed Type: Code_Defect
Severity: Important Priority:
Subsystem: Resolution: Fixed
Last Modified: 2012-11-08 13:47:11
Version Found In: 2011-04-19 20:30:31 085b6a1bbb
Description:
While most of the generated fossil output is valid xhtml, there are still several places that aren't.

These include not using & instead of a plain & when generating URLs in href attributes, using <br> and <hr> instead of <br /> and <hr />, using   instead of   and finally the occasional <img> instead of <img />.

The attached patch corrects these issues so that fossil can return valid application/xhtml+xml content.

<hr /><i>dmitry added on 2011-09-08 23:11:38 UTC:</i><br />
Please note that pages generated by Fossil has HTML5 doctype. HTML5 allows unclosed single tags such as &lt;br&gt;.

<hr /><i>jan.nijtmans added on 2012-11-06 09:05:14 UTC:</i><br />
Most of this patch just changes &amp;nbsp; to &amp;#160; which is just the same in html (not in xhmtl). The main part of the remaining has to do with the link
generation using the function style_submenu_element(): This function should generate links with all &amp;'s escaped as &amp;amp;'s, but it doesn't.
<p>
Wouldn't it be better to modify style_submenu_element() such that it escapes all &amp;'s to &amp;amp;? Then those (minor) html5 violations are fixed all at once.

<hr /><i>jan.nijtmans added on 2012-11-08 09:51:47 UTC:</i><br />
Suggested fix committed to branch "ticket-5ff2043c96".

I put many pages, such as "timeline" to the validator.w3.org, and
it reduced dramatically the number of errors. The current "timeline"
page dropped from 85 to only 4 errors. That's better than
changing many &amp;'s to &amp;amp;'s in the source code, as this
patch does. Changing only the href() and style_submenu_element()
functions has much more effect.

<hr /><i>jan.nijtmans added on 2012-11-08 10:31:49 UTC:</i><br />
<pre>Note that xhtml errors can result in real bugs. For
example have a look at the report list:
        [http://www.fossil-scm.org/fossil/reportlist]
When logged in, this page contains links &#91;copy&#93; after each
report. This link works fine on Firefox, but it doesn't work
on Internet Explorer, and this time IE is not to blame ;-)

The suggested patch makes the &#91;copy&#93; link on
the reportlist page work on both Firefox and Internet Explorer.

The reason is that the link has the form:
     http://www.fossil-scm.org/fossil/rptedit?rn=1&amp;copy=1
But Internet Explorer interprets that as:
     http://www.fossil-scm.org/fossil/rptedit?rn=1©=1
as &amp;copy is short for the copyright sign (the ';'
is not mandatory in html5).

See: [http://www.w3.org/TR/html5/named-character-references.html#named-character-references],
and note that a "copy" named character reference exists without a final ';'.
</pre>

Attachments: