r69633 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69632‎ | r69633 | r69634 >
Date:17:35, 20 July 2010
Author:platonides
Status:ok
Tags:
Comment:
Follow up r69444. Address CR comment by Simetrical.
Modified paths:
  • /trunk/phase3/skins/common/wikibits.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/wikibits.js
@@ -325,21 +325,21 @@
326326 }
327327 var uls = root.getElementsByTagName( 'ul' );
328328 var node;
329 - if (uls.length > 0) {
 329+ if ( uls.length > 0 ) {
330330 node = uls[0];
331331 } else {
332 - node = document.createElement('ul');
333 - var lc = null;
334 - for (var i in root.childNodes) { /* get root.lastElementChild */
335 - if (root.childNodes[i].nodeType == 1) {
336 - lc = root.childNodes[i];
 332+ node = document.createElement( 'ul' );
 333+ var lastElementChild = null;
 334+ for ( var i = 0; i < root.childNodes.length; ++i ) { /* get root.lastElementChild */
 335+ if ( root.childNodes[i].nodeType == 1 ) {
 336+ lastElementChild = root.childNodes[i];
337337 }
338338 }
339 - if (lc && lc.nodeName.match(/div/i)) {
 339+ if ( lastElementChild && lastElementChild.nodeName.match( /div/i ) ) {
340340 /* Insert into the menu divs */
341 - lc.appendChild(node);
 341+ lastElementChild.appendChild( node );
342342 } else {
343 - root.appendChild(node);
 343+ root.appendChild( node );
344344 }
345345 }
346346 if ( !node ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r69444Make addPortletLink() work even if the ul is not there....platonides21:55, 16 July 2010

Status & tagging log