From: Platonides Date: Tue, 20 Jul 2010 17:35:55 +0000 (+0000) Subject: Follow up r69444. Address CR comment by Simetrical. X-Git-Tag: 1.31.0-rc.0~36040 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=0c23ac2f62006daab69e5c0bc770f4e7a2ea998b;p=lhc%2Fweb%2Fwiklou.git Follow up r69444. Address CR comment by Simetrical. --- 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 ) {