TitleBroken heading anchors
Date10-May-2005 18:58:40 EEST
Bug criticalityCosmeticBug
Browser versionFirefox 1.03
Bug statusClosedBug
PageProvider usedVersioningFileProvider
Servlet Containertomcat-5.0.27
Operating SystemGentoo Linux 2005.0
Java versionsun-jdk-

The following sample page demonstrates the problem:

!!!Simple test

The above heading creates a broken anchor, as per HTML 4.01.

This produces a heading (H2) with an anchor (A) inside it, like this:

<h2><a name="section-SandBox-SimpleTest"/>Simple test</h2>
<p>The above heading creates a broken anchor, as per HTML 4.01.


Note that the anchor is terminated, not wrapped around the content of the header. This produces the following HTML 4.01 validation error:

Error: end tag for A omitted; possible causes include a missing end tag, improper nesting of elements, or use of an element where it is not allowed

The visual problem is that any CSS that does something pretty with the anchor tag gets confused and applies the anchor style to all the text that follows the header, until the next generated close anchor. The redman template demonstrates this perfectly.

While this bug is cosmetic, it really messes up display. :-)

The solution is to wrap the entire header content in the anchor, like this:

<h2><a name="section-SandBox-SimpleTest">Simple test</a></h2>
<p>The above heading creates a broken anchor, as per HTML 4.01.



Ungh. This was actually changed in 2.2.13, it used to be as you stated. This was done because some people had trouble applying CSS to headings.

But I didn't think of looking into the HTML spec... I'll change it back.

(Or would it be better to emit just an empty tag pair?

<h2><a name="section-SandBox-SimpleTest"></a>Simple test</h2>
<p>The above heading creates a broken anchor, as per HTML 4.01.


-- JanneJalkanen

I think an empty tag pair is a good compromise. My 4.01 validator thinks its fine, the anchor works for sectional hyperlinking and CSS works. Good idea.

I don't know anything about the release process for JspWiki. How long do you think it'll be before a release exists that addresses this issue? I'd like to know whether I should wait for the next release or ask for a patch that I can apply to the source and build myself.


A few days; I'm currently on a business trip, and will be returning on about Sunday. I'll probably fix this and maybe some others over the flight, so Monday-ish (in nightly build) might be a good guess.

-- JanneJalkanen, 12-May-2005 (Thursday)

Changed in 2.2.14. Please reopen, if there are problems.

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-18) was last changed on 13-Sep-2007 00:26 by MurrayAltheim