Fix r67544 per CR: cancel event properly in TOC show/hide click handler
authorRoan Kattouw <catrope@users.mediawiki.org>
Mon, 14 Jun 2010 17:51:34 +0000 (17:51 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Mon, 14 Jun 2010 17:51:34 +0000 (17:51 +0000)
includes/DefaultSettings.php
skins/common/wikibits.js

index 02ec8cd..67d9378 100644 (file)
@@ -1537,7 +1537,7 @@ $wgCacheEpoch = '20030516000000';
  * to ensure that client-side caches do not keep obsolete copies of global
  * styles.
  */
-$wgStyleVersion = '289';
+$wgStyleVersion = '290';
 
 /**
  * This will cache static pages for non-logged-in users to reduce
index 94d1b2a..bf05440 100644 (file)
@@ -146,7 +146,7 @@ function showTocToggle() {
                toggleLink.id = 'togglelink';
                toggleLink.className = 'internal';
                toggleLink.href = '#';
-               toggleLink.onclick = toggleToc;
+               addClickHandler( toggleLink, function( evt ) { toggleToc(); return killEvt( evt ); } );
                
                toggleLink.appendChild( document.createTextNode( tocHideText ) );
 
@@ -173,6 +173,17 @@ function changeText( el, newText ) {
        }
 }
 
+function killEvt( evt ) {
+       evt = evt || window.event || window.Event; // W3C, IE, Netscape
+       if ( typeof ( evt.preventDefault ) != 'undefined' ) {
+               evt.preventDefault(); // Don't follow the link
+               evt.stopPropagation();
+       } else {
+               evt.cancelBubble = true; // IE
+       }
+       return false; // Don't follow the link (IE)
+}
+
 function toggleToc() {
        var tocmain = document.getElementById( 'toc' );
        var toc = document.getElementById('toc').getElementsByTagName('ul')[0];