IEFixes: Clean up duplicate variables
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 10 Apr 2014 18:40:00 +0000 (11:40 -0700)
committerKrinkle <krinklemail@gmail.com>
Fri, 11 Apr 2014 18:20:34 +0000 (18:20 +0000)
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 28cca60fcf493409d9dfd.

Change-Id: I81436c218eedf7c1930703c181a58adb2e5f44b0

skins/common/IEFixes.js

index 3174af1..6f240eb 100644 (file)
@@ -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;