* (bug 35572) Blocks appear to succeed even if query fails due to wrong DB structure
* (bug 31757) Add a word-separator between help-messages in HTMLForm
* (bug 30410) Removed deprecated $wgFilterCallback and the 'filtered' API error.
-* (bug 32604) Some messages needs escaping of wikitext inside username
+* (bug 32604) Some messages needs escaping of wikitext inside username.
* (bug 36537) Rename wfArrayToCGI to wfArrayToCgi for consistency with wfCgiToArray.
-* (bug 25946) The message on the top of Special:RecentChanges is now displayed
+* (bug 25946) The message on the top of Special:RecentChanges is now displayed.
in user language instead of content language.
* (bug 35264) Wrong type used for <ns> in export.xsd
* (bug 24985) Use $wgTmpDirectory as the default temp directory so that people
that don't have stylesheets.
* (bug 36812) Special:ActiveUsers "Hide bots" should hide users from any group
having the "bot" user right, instead of just the default "bot" user group.
+* (bug 35082) mw.util.addPortletLink incorrectly adds link to mutiple <ul> tags.
=== API changes in 1.20 ===
* (bug 34316) Add ability to retrieve maximum upload size from MediaWiki API.
return null;
}
// Select the first (most likely only) unordered list inside the portlet
- $ul = $portlet.find( 'ul' );
+ $ul = $portlet.find( 'ul' ).eq( 0 );
// If it didn't have an unordered list yet, create it
if ( $ul.length === 0 ) {
+
+ $ul = $( '<ul>' );
+
// If there's no <div> inside, append it to the portlet directly
if ( $portlet.find( 'div:first' ).length === 0 ) {
- $portlet.append( '<ul></ul>' );
+ $portlet.append( $ul );
} else {
// otherwise if there's a div (such as div.body or div.pBody)
// append the <ul> to last (most likely only) div
- $portlet.find( 'div' ).eq( -1 ).append( '<ul></ul>' );
+ $portlet.find( 'div' ).eq( -1 ).append( $ul );
}
- // Select the created element
- $ul = $portlet.find( 'ul' ).eq( 0 );
}
// Just in case..
if ( $ul.length === 0 ) {
* one element can have a given id.
*/
test( 'addPortletLink', function () {
- var pTestTb, vectorTabs, tbRL, tbMW, $tbMW, tbRLDM, caFoo;
- expect(7);
+ var pTestTb, vectorTabs, tbRL, cuQuux, $cuQuux, tbMW, $tbMW, tbRLDM, caFoo;
+ expect( 8 );
pTestTb = '\
<div class="portlet" id="p-test-tb">\
+ <h5>Toolbox</h5>\
<ul class="body"></ul>\
</div>';
+ pCustom = '\
+ <div class="portlet" id="p-test-custom">\
+ <h5>Views</h5>\
+ <ul class="body">\
+ <li id="c-foo"><a href="#">Foo</a></li>\
+ <li id="c-barmenu">\
+ <ul>\
+ <li id="c-bar-baz"><a href="#">Baz</a></a>\
+ </ul>\
+ </li>\
+ </ul>\
+ </div>';
vectorTabs = '\
<div id="p-test-views" class="vectorTabs">\
<h5>Views</h5>\
<ul></ul>\
</div>';
- $('#qunit-fixture').append(pTestTb, vectorTabs);
+ $( '#qunit-fixture' ).append( pTestTb, pCustom, vectorTabs );
tbRL = mw.util.addPortletLink( 'p-test-tb', '//mediawiki.org/wiki/ResourceLoader',
'ResourceLoader', 't-rl', 'More info about ResourceLoader on MediaWiki.org ', 'l' );
equal( $tbMW.closest( '.portlet' ).attr( 'id' ), 'p-test-tb', 'Link was inserted within correct portlet' );
equal( $tbMW.next().attr( 'id' ), 't-rl', 'Link is in the correct position (by passing nextnode)' );
+ cuQuux = mw.util.addPortletLink( 'p-test-custom', '#', 'Quux' );
+ $cuQuux = $(cuQuux);
+
+ equal(
+ $( '#p-test-custom #c-barmenu ul li' ).length,
+ 1,
+ 'addPortletLink did not add the item to all <ul> elements in the portlet (bug 35082)'
+ );
+
tbRLDM = mw.util.addPortletLink( 'p-test-tb', '//mediawiki.org/wiki/RL/DM',
'Default modules', 't-rldm', 'List of all default modules ', 'd', '#t-rl' );