From 739455ef84caaccac1d4cccfbbf1dd4769284f45 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 10 Apr 2014 11:40:00 -0700 Subject: [PATCH] IEFixes: Clean up duplicate variables Declare the global ones as global, and assign them as implicit globals instead of having both a local variable *and* a window property. hasClass and expandedURLs are local variable only. Follows-up 28cca60, fcf4934, 09d9dfd. Change-Id: I81436c218eedf7c1930703c181a58adb2e5f44b0 --- skins/common/IEFixes.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/skins/common/IEFixes.js b/skins/common/IEFixes.js index 3174af134d..6f240eb041 100644 --- a/skins/common/IEFixes.js +++ b/skins/common/IEFixes.js @@ -1,17 +1,20 @@ -// IE fixes javascript loaded by wikibits.js for IE <= 6.0 +/** + * IE fixes javascript loaded by wikibits.js for IE <= 6.0 + */ +/*global isMSIE55:true, doneIETransform:true, doneIEAlphaFix:true */ +/*global hookit:true, fixalpha:true, relativeforfloats:true, setrelative:true */ ( function ( mw, $ ) { -var doneIEAlphaFix, doneIETransform, expandedURLs, fixalpha, isMSIE55, - relativeforfloats, setrelative, hasClass; +var expandedURLs, hasClass; // Also returns true for IE6, 7, 8, 9 and 10. createPopup is removed in IE11. // Good thing this is only loaded for IE <= 6 by wikibits. // Might as well set it to true. -isMSIE55 = window.isMSIE55 = ( window.showModalDialog && window.clipboardData && window.createPopup ); -doneIETransform = window.doneIETransform = undefined; -doneIEAlphaFix = window.doneIEAlphaFix = undefined; +isMSIE55 = ( window.showModalDialog && window.clipboardData && window.createPopup ); +doneIETransform = false; +doneIEAlphaFix = false; -window.hookit = function () { +hookit = function () { if ( !doneIETransform && document.getElementById && document.getElementById( 'bodyContent' ) ) { doneIETransform = true; relativeforfloats(); @@ -20,11 +23,11 @@ window.hookit = function () { }; if ( document.attachEvent ) { - document.attachEvent( 'onreadystatechange', window.hookit ); + document.attachEvent( 'onreadystatechange', hookit ); } // png alpha transparency fixes -fixalpha = window.fixalpha = function ( logoId ) { +fixalpha = function ( logoId ) { // bg if ( isMSIE55 && !doneIEAlphaFix ) { var bg, imageUrl, linkFix, logoa, logospan, plogo; @@ -77,7 +80,7 @@ if ( isMSIE55 ) { } // fix ie6 disappering float bug -relativeforfloats = window.relativeforfloats = function () { +relativeforfloats = function () { var bc, tables, divs; bc = document.getElementById( 'bodyContent' ); if ( bc ) { @@ -88,7 +91,7 @@ relativeforfloats = window.relativeforfloats = function () { } }; -setrelative = window.setrelative = function ( nodes ) { +setrelative = function ( nodes ) { var i = 0; while ( i < nodes.length ) { if ( ( ( nodes[i].style['float'] && nodes[i].style['float'] !== ( 'none' ) || @@ -112,8 +115,6 @@ hasClass = function ( classText, classWanted ) { return false; }; -expandedURLs = window.expandedURLs = undefined; - window.onbeforeprint = function () { var allLinks, contentEl, expandedLink, expandedText, i; -- 2.20.1