Don't add empty title attributes to anchor links
authorAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 31 Mar 2009 14:26:40 +0000 (14:26 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 31 Mar 2009 14:26:40 +0000 (14:26 +0000)
All parser tests updated.

RELEASE-NOTES
includes/Linker.php
maintenance/parserTests.txt

index 7494d12..198821d 100644 (file)
@@ -313,6 +313,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   with <strong> tags, helps with text-based browsers
 * (bug 18259) Special:DeletedContributions now also uses
   MediaWiki:Sp-contributions-logs for the link to Special:Log
+* Don't add empty title="" attributes to links to anchors on the current page
 
 == API changes in 1.15 ==
 * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions
index e862c3b..e916b04 100644 (file)
@@ -291,7 +291,10 @@ class Linker {
                }
 
                # Get a default title attribute.
-               if( in_array( 'known', $options ) ) {
+               if( $target->getPrefixedText() == '' ) {
+                       # A link like [[#Foo]].  This used to mean an empty title
+                       # attribute, but that's silly.  Just don't output a title.
+               } elseif( in_array( 'known', $options ) ) {
                        $defaults['title'] = $target->getPrefixedText();
                } else {
                        $defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
index 1a42700..c7d0bc2 100644 (file)
@@ -1454,7 +1454,7 @@ Example for such a section: == < ==
 !! input
 [[%23%3c]][[%23%3e]]
 !! result
-<p><a href="#.3C" title="">#&lt;</a><a href="#.3E" title="">#&gt;</a>
+<p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
 </p>
 !! end
 
@@ -4662,7 +4662,7 @@ Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=
 !! input
 <span id="æ: v">byte</span>[[#æ: v|backlink]]
 !! result
-<p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
+<p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
 </p>
 !! end