Last modified: 2010-08-18 02:49:50 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T26835, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 24835 - Compatibility anchors cause unnecessary <p> tags
Compatibility anchors cause unnecessary <p> tags
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-08-17 21:42 UTC by entlinkt
Modified: 2010-08-18 02:49 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description entlinkt 2010-08-17 21:42:14 UTC
The compatibility anchors inserted when a header contains special characters are wrapped in <p> tags. The wikitext

== áàâ ==

is rendered as

<p><a id=".C3.A1.C3.A0.C3.A2" name=".C3.A1.C3.A0.C3.A2"></a></p>
<h2><span class="mw-headline" id="áàâ">áàâ</span></h2>

Why are the <p> tags there? Probably because only block elements are allowed as children of the bodytext. But these paragraphs can affect rendering because they have top and bottom margins (which happen to collapse with other margins most of the times, but not necessarily always).

I'd prefer one of the following:

<div id=".C3.A1.C3.A0.C3.A2"></div>
<h2><span class="mw-headline" id="áàâ">áàâ</span></h2>

or

<h2><a id=".C3.A1.C3.A0.C3.A2" name=".C3.A1.C3.A0.C3.A2"></a>
<span class="mw-headline" id="áàâ">áàâ</span></h2>

Besides that, I don't see a reason for the name attribute? It is not valid in HTML5 (looks quite odd if something that has been added because of HTML5 breaks validation) and only needed by browsers of the Netscape 4 era. The real headers don't have named anchors either, so that's rather pointless.
Comment 1 Aryeh Gregor (not reading bugmail, please e-mail directly) 2010-08-17 21:57:19 UTC
Fixed in r71215.  When I wrote this code long ago, I based it on the way the existing code looked, which IIRC was actually an <a> tag, which did get put in that silly paragraph.  At some intervening point it changed.  I made it a <div> as you suggested.

I didn't actually add a name attribute (see the diff).  I assume there's some magic in the parser or Sanitizer or something that adds it, I dunno.  name on <a> is conforming in HTML5, actually, although it raises a warning:

http://www.whatwg.org/specs/web-apps/current-work/multipage/obsolete.html#obsolete-but-conforming-features
Comment 2 entlinkt 2010-08-18 02:49:50 UTC
Thanks. I tend to blame Tidy for the name attribute (cf. http://tidy.sourceforge.net/docs/quickref.html#anchor-as-name).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links