From 0c23ac2f62006daab69e5c0bc770f4e7a2ea998b Mon Sep 17 00:00:00 2001 From: Platonides Date: Tue, 20 Jul 2010 17:35:55 +0000 Subject: [PATCH] Follow up r69444. Address CR comment by Simetrical. --- skins/common/wikibits.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index 8ab3746f3f..d7bd3f98b9 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -325,21 +325,21 @@ function addPortletLink( portlet, href, text, id, tooltip, accesskey, nextnode ) } var uls = root.getElementsByTagName( 'ul' ); var node; - if (uls.length > 0) { + if ( uls.length > 0 ) { node = uls[0]; } else { - node = document.createElement('ul'); - var lc = null; - for (var i in root.childNodes) { /* get root.lastElementChild */ - if (root.childNodes[i].nodeType == 1) { - lc = root.childNodes[i]; + node = document.createElement( 'ul' ); + var lastElementChild = null; + for ( var i = 0; i < root.childNodes.length; ++i ) { /* get root.lastElementChild */ + if ( root.childNodes[i].nodeType == 1 ) { + lastElementChild = root.childNodes[i]; } } - if (lc && lc.nodeName.match(/div/i)) { + if ( lastElementChild && lastElementChild.nodeName.match( /div/i ) ) { /* Insert into the menu divs */ - lc.appendChild(node); + lastElementChild.appendChild( node ); } else { - root.appendChild(node); + root.appendChild( node ); } } if ( !node ) { -- 2.20.1