From 2e315eeaa370f27e7deca1de5393576aa52be81c Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 14 Jun 2010 17:51:34 +0000 Subject: [PATCH] Fix r67544 per CR: cancel event properly in TOC show/hide click handler --- includes/DefaultSettings.php | 2 +- skins/common/wikibits.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 02ec8cd179..67d9378c85 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index 94d1b2a4e0..bf05440cda 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -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]; -- 2.20.1