]> source.dussan.org Git - jquery-ui.git/commitdiff
Lint fixes.
authorScott González <scott.gonzalez@gmail.com>
Mon, 2 Apr 2012 23:12:21 +0000 (19:12 -0400)
committerScott González <scott.gonzalez@gmail.com>
Mon, 2 Apr 2012 23:12:21 +0000 (19:12 -0400)
18 files changed:
ui/jquery.effects.core.js
ui/jquery.effects.explode.js
ui/jquery.effects.fold.js
ui/jquery.effects.scale.js
ui/jquery.effects.shake.js
ui/jquery.effects.slide.js
ui/jquery.ui.accordion.js
ui/jquery.ui.autocomplete.js
ui/jquery.ui.button.js
ui/jquery.ui.core.js
ui/jquery.ui.dialog.js
ui/jquery.ui.menu.js
ui/jquery.ui.mouse.js
ui/jquery.ui.progressbar.js
ui/jquery.ui.slider.js
ui/jquery.ui.tabs.js
ui/jquery.ui.tooltip.js
ui/jquery.ui.widget.js

index 62d6b2c380c6f78a3d54580ffc18076d83b6741e..1d56ae62fb4bb347720edbfa019d5745581acc90 100644 (file)
@@ -7,9 +7,11 @@
  *
  * http://docs.jquery.com/UI/Effects/
  */
-;jQuery.effects || (function($, undefined) {
+;(jQuery.effects || (function($, undefined) {
 
-var backCompat = $.uiBackCompat !== false;
+var backCompat = $.uiBackCompat !== false,
+       // prefix used for storing data on .data()
+       dataSpace = "ui-effects-";
 
 $.effects = {
        effect: {}
@@ -18,6 +20,7 @@ $.effects = {
 /******************************************************************************/
 /****************************** COLOR ANIMATIONS ******************************/
 /******************************************************************************/
+(function() {
 
 // override the animation for color styles
 $.each(["backgroundColor", "borderBottomColor", "borderLeftColor",
@@ -46,28 +49,34 @@ function getRGB(color) {
                var result;
 
                // Check if we're already dealing with an array of colors
-               if ( color && color.constructor === Array && color.length === 3 )
-                               return color;
+               if ( color && color.constructor === Array && color.length === 3 ) {
+                       return color;
+               }
 
                // Look for rgb(num,num,num)
-               if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
-                               return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
+               if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) {
+                       return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
+               }
 
                // Look for rgb(num%,num%,num%)
-               if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
-                               return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
+               if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) {
+                       return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
+               }
 
                // Look for #a0b1c2
-               if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
-                               return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
+               if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) {
+                       return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
+               }
 
                // Look for #fff
-               if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
-                               return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
+               if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) {
+                       return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
+               }
 
                // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
-               if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
-                               return colors["transparent"];
+               if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) {
+                       return colors.transparent;
+               }
 
                // Otherwise, we're most likely dealing with a named color
                return colors[$.trim(color).toLowerCase()];
@@ -80,14 +89,15 @@ function getColor(elem, attr) {
                                color = $.css(elem, attr);
 
                                // Keep going until we find an element that has color, or we hit the body
-                               if ( color != "" && color !== "transparent" || $.nodeName(elem, "body") )
-                                               break;
+                               if ( color && color !== "transparent" || $.nodeName(elem, "body") ) {
+                                       break;
+                               }
 
                                attr = "backgroundColor";
                } while ( elem = elem.parentNode );
 
                return getRGB(color);
-};
+}
 
 // Some named colors to work with
 // From Interface by Stefan Petre
@@ -140,11 +150,12 @@ var colors = {
        transparent: [255,255,255]
 };
 
-
+})();
 
 /******************************************************************************/
 /****************************** CLASS ANIMATIONS ******************************/
 /******************************************************************************/
+(function() {
 
 var classAnimationActions = [ "add", "remove", "toggle" ],
        shorthandStyles = {
@@ -157,9 +168,7 @@ var classAnimationActions = [ "add", "remove", "toggle" ],
                borderWidth: 1,
                margin: 1,
                padding: 1
-       },
-       // prefix used for storing data on .data()
-       dataSpace = "ui-effects-";
+       };
 
 $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
        $.fx.step[ prop ] = function( fx ) {
@@ -206,7 +215,7 @@ function styleDifference( oldStyle, newStyle ) {
 
        for ( name in newStyle ) {
                value = newStyle[ name ];
-               if ( oldStyle[ name ] != value ) {
+               if ( oldStyle[ name ] !== value ) {
                        if ( !shorthandStyles[ name ] ) {
                                if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
                                        diff[ name ] = value;
@@ -332,12 +341,14 @@ $.fn.extend({
        }
 });
 
-
+})();
 
 /******************************************************************************/
 /*********************************** EFFECTS **********************************/
 /******************************************************************************/
 
+(function() {
+
 $.extend( $.effects, {
        version: "@VERSION",
 
@@ -473,9 +484,11 @@ $.extend( $.effects, {
 
        setTransition: function( element, list, factor, value ) {
                value = value || {};
-               $.each( list, function(i, x){
+               $.each( list, function( i, x ) {
                        var unit = element.cssUnit( x );
-                       if ( unit[ 0 ] > 0 ) value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
+                       if ( unit[ 0 ] > 0 ) {
+                               value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
+                       }
                });
                return value;
        }
@@ -651,19 +664,22 @@ $.fn.extend({
                        val = [];
 
                $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
-                       if ( style.indexOf( unit ) > 0 )
+                       if ( style.indexOf( unit ) > 0 ) {
                                val = [ parseFloat( style ), unit ];
+                       }
                });
                return val;
        }
 });
 
-
+})();
 
 /******************************************************************************/
 /*********************************** EASING ***********************************/
 /******************************************************************************/
 
+(function() {
+
 // based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
 
 var baseEasings = {};
@@ -709,4 +725,6 @@ $.each( baseEasings, function( name, easeIn ) {
        };
 });
 
-})(jQuery);
+})();
+
+})(jQuery));
index d030efc7045199958f13162fc6389a627578449c..ae3efb21e5f5ed7ee6853ef6b8094a37c58949dd 100644 (file)
@@ -31,6 +31,14 @@ $.effects.effect.explode = function( o, done ) {
                // loop
                i, j, left, top, mx, my;
 
+       // children animate complete:
+       function childComplete() {
+               pieces.push( this );
+               if ( pieces.length === rows * cells ) {
+                       animComplete();
+               }
+       }
+
        // clone the element for each row and cell.
        for( i = 0; i < rows ; i++ ) { // ===>
                top = offset.top + i * height;
@@ -73,14 +81,6 @@ $.effects.effect.explode = function( o, done ) {
                }
        }
 
-       // children animate complete:
-       function childComplete() {
-               pieces.push( this );
-               if ( pieces.length == rows * cells ) {
-                       animComplete();
-               }
-       }
-
        function animComplete() {
                el.css({
                        visibility: "visible"
index f33c2d050c5e758db0ec7d06992720487c87001e..17aa9a36baeb15db1f7a65ba413b036d9930b808 100644 (file)
@@ -23,11 +23,12 @@ $.effects.effect.fold = function( o, done ) {
                size = o.size || 15,
                percent = /([0-9]+)%/.exec( size ),
                horizFirst = !!o.horizFirst,
-               widthFirst = show != horizFirst,
+               widthFirst = show !== horizFirst,
                ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
                duration = o.duration / 2,
                wrapper, distance,
-               animation1 = {}, animation2 = {};
+               animation1 = {},
+               animation2 = {};
 
        $.effects.save( el, props );
        el.show();
index 63b95275cbc7d77ca36924451a72963f51d70598..83b41d3c26e8d3c8c3dd16ee0f6ce0dd39134b76 100644 (file)
@@ -47,7 +47,8 @@ $.effects.effect.scale = function( o, done ) {
        var el = $( this ),
                options = $.extend( true, {}, o ),
                mode = $.effects.setMode( el, o.mode || "effect" ),
-               percent = parseInt( o.percent, 10 ) || ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode == "hide" ? 0 : 100 ) ),
+               percent = parseInt( o.percent, 10 ) ||
+                       ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
                direction = o.direction || "both",
                origin = o.origin,
                original = { 
@@ -57,8 +58,8 @@ $.effects.effect.scale = function( o, done ) {
                        outerWidth: el.outerWidth()
                },
                factor = {
-                       y: direction != "horizontal" ? (percent / 100) : 1,
-                       x: direction != "vertical" ? (percent / 100) : 1
+                       y: direction !== "horizontal" ? (percent / 100) : 1,
+                       x: direction !== "vertical" ? (percent / 100) : 1
                }; 
 
        // We are going to pass this effect to the size effect:
@@ -67,12 +68,12 @@ $.effects.effect.scale = function( o, done ) {
        options.complete = done;
 
        // Set default origin and restore for show/hide
-       if ( mode != "effect" ) { 
+       if ( mode !== "effect" ) { 
                options.origin = origin || ["middle","center"];
                options.restore = true;
        }
 
-       options.from = o.from || ( mode == "show" ? { height: 0, width: 0 } : original ); 
+       options.from = o.from || ( mode === "show" ? { height: 0, width: 0 } : original ); 
        options.to = {
                height: original.height * factor.y, 
                width: original.width * factor.x,
@@ -82,11 +83,11 @@ $.effects.effect.scale = function( o, done ) {
 
        // Fade option to support puff
        if ( options.fade ) {
-               if ( mode == "show" ) {
+               if ( mode === "show" ) {
                        options.from.opacity = 0; 
                        options.to.opacity = 1;
                }
-               if ( mode == "hide" ) {
+               if ( mode === "hide" ) {
                        options.from.opacity = 1; 
                        options.to.opacity = 0;
                }
@@ -146,7 +147,7 @@ $.effects.effect.size = function( o, done ) {
        };
 
        // Scale the css box
-       if ( scale == "box" || scale == "both" ) {
+       if ( scale === "box" || scale === "both" ) {
 
                // Vertical props scaling
                if ( factor.from.y !== factor.to.y ) { 
@@ -164,7 +165,7 @@ $.effects.effect.size = function( o, done ) {
        }
 
        // Scale the content
-       if ( scale == "content" || scale == "both" ) { 
+       if ( scale === "content" || scale === "both" ) { 
 
                // Vertical props scaling
                if ( factor.from.y !== factor.to.y ) { 
@@ -190,7 +191,7 @@ $.effects.effect.size = function( o, done ) {
        el.css( el.from ); // set top & left
 
        // Animate
-       if ( scale == "content" || scale == "both" ) { // Scale the children
+       if ( scale === "content" || scale === "both" ) { // Scale the children
 
                // Add margins/font-size
                vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
@@ -203,8 +204,10 @@ $.effects.effect.size = function( o, done ) {
                                        height: child.height(), 
                                        width: child.width()
                                };
-                       if (restore) $.effects.save(child, props2);
-                       
+                       if (restore) {
+                               $.effects.save(child, props2);
+                       }
+
                        child.from = {
                                height: c_original.height * factor.from.y, 
                                width: c_original.width * factor.from.x
@@ -215,13 +218,13 @@ $.effects.effect.size = function( o, done ) {
                        };
 
                        // Vertical props scaling
-                       if ( factor.from.y != factor.to.y ) { 
+                       if ( factor.from.y !== factor.to.y ) { 
                                child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
                                child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
                        }
 
                        // Horizontal props scaling
-                       if ( factor.from.x != factor.to.x ) {
+                       if ( factor.from.x !== factor.to.x ) {
                                child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
                                child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
                        }
@@ -231,7 +234,9 @@ $.effects.effect.size = function( o, done ) {
                        child.animate( child.to, o.duration, o.easing, function() {
 
                                // Restore children
-                               if (restore) $.effects.restore( child, props2 ); 
+                               if ( restore ) {
+                                       $.effects.restore( child, props2 );
+                               }
                        });
                });
        }
@@ -245,7 +250,7 @@ $.effects.effect.size = function( o, done ) {
                        if ( el.to.opacity === 0 ) {
                                el.css( "opacity", el.from.opacity );
                        }
-                       if( mode == "hide" ) {
+                       if( mode === "hide" ) {
                                el.hide();
                        }
                        $.effects.restore( el, restore ? props : props1 );
index c6276d15ef3bcd665166d3bc6558b1091aa364ab..700c6df3d7789a195faac20e0af8ea241e5eb5c0 100644 (file)
@@ -22,8 +22,8 @@ $.effects.effect.shake = function( o, done ) {
                times = o.times || 3,
                anims = times * 2 + 1,
                speed = o.duration,
-               ref = (direction == "up" || direction == "down") ? "top" : "left",
-               positiveMotion = (direction == "up" || direction == "left"),
+               ref = (direction === "up" || direction === "down") ? "top" : "left",
+               positiveMotion = (direction === "up" || direction === "left"),
                animation = {},
                animation1 = {},
                animation2 = {},
@@ -32,7 +32,6 @@ $.effects.effect.shake = function( o, done ) {
                // we will need to re-assemble the queue to stack our animations in place
                queue = el.queue(),
                queuelen = queue.length;
-               
 
        $.effects.save( el, props );
        el.show();
index 5c8eb25669f42de98d455c97fa0de5780e24ed51..77d540a9c166b9038d179c3742e0f099f7a020f0 100644 (file)
@@ -20,8 +20,8 @@ $.effects.effect.slide = function( o, done ) {
                mode = $.effects.setMode( el, o.mode || "show" ),
                show = mode === "show",
                direction = o.direction || "left",
-               ref = (direction == "up" || direction == "down") ? "top" : "left",
-               positiveMotion = (direction == "up" || direction == "left"),
+               ref = (direction === "up" || direction === "down") ? "top" : "left",
+               positiveMotion = (direction === "up" || direction === "left"),
                distance,
                animation = {},
                size;
index 92245d28e2881d639b5ca1104b04e3261a43fae2..00ecd1b64c6b8260d044039e398d0b6b24ed762f 100644 (file)
  *     jquery.ui.widget.js
  */
 (function( $, undefined ) {
-       var uid = 0;
+       var uid = 0,
+               hideProps = {},
+               showProps = {},
+               showPropsAdjust = {};
+
+hideProps.height = hideProps.paddingTop = hideProps.paddingBottom =
+       hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide";
+showProps.height = showProps.paddingTop = showProps.paddingBottom =
+       showProps.borderTopWidth = showProps.borderBottomWidth = "show";
+$.extend( showPropsAdjust, showProps, { accordionHeight: "show" } );
+
+$.fx.step.accordionHeight = function( fx ) {
+       var elem = $( fx.elem ),
+               data = elem.data( "ui-accordion-height" );
+       elem.height( data.total - elem.outerHeight() - data.toHide.outerHeight() + elem.height() );
+};
 
 $.widget( "ui.accordion", {
        version: "@VERSION",
@@ -151,7 +166,8 @@ $.widget( "ui.accordion", {
        },
 
        _destroy: function() {
-               var accordionId = this.accordionId;
+               var contents,
+                       accordionId = this.accordionId;
 
                // clean up main element
                this.element
@@ -173,7 +189,7 @@ $.widget( "ui.accordion", {
                this._destroyIcons();
 
                // clean up content panels
-               var contents = this.headers.next()
+               contents = this.headers.next()
                        .css( "display", "" )
                        .removeAttr( "role" )
                        .removeAttr( "aria-expanded" )
@@ -514,20 +530,6 @@ $.widget( "ui.accordion", {
        }
 });
 
-$.fx.step.accordionHeight = function( fx ) {
-       var elem = $( fx.elem ),
-               data = elem.data( "ui-accordion-height" );
-       elem.height( data.total - elem.outerHeight() - data.toHide.outerHeight() + elem.height() );
-};
-var hideProps = {},
-       showProps = {},
-       showPropsAdjust = {};
-hideProps.height = hideProps.paddingTop = hideProps.paddingBottom =
-       hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide";
-showProps.height = showProps.paddingTop = showProps.paddingBottom =
-       showProps.borderTopWidth = showProps.borderBottomWidth = "show";
-$.extend( showPropsAdjust, showProps, { accordionHeight: "show" } );
-
 
 
 // DEPRECATED
index 07992ab2eac00da5ae274e8d8caa6044d51ebafa..5ec5790ed80341f5e25fb097effac528695b1621 100644 (file)
@@ -1,4 +1,4 @@
-/*!
+/*
  * jQuery UI Autocomplete @VERSION
  *
  * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
@@ -108,7 +108,7 @@ $.widget( "ui.autocomplete", {
                                                suppressKeyPress = true;
                                                event.preventDefault();
                                        }
-                                       // passthrough - ENTER and TAB both select the current element
+                                       //passthrough - ENTER and TAB both select the current element
                                case keyCode.TAB:
                                        if ( !self.menu.active ) {
                                                return;
@@ -238,7 +238,7 @@ $.widget( "ui.autocomplete", {
                                select: function( event, ui ) {
                                        // back compat for _renderItem using item.autocomplete, via #7810
                                        // TODO remove the fallback, see #8156
-                                       var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" );
+                                       var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ),
                                                previous = self.previous;
 
                                        // only trigger when focus was lost (click on menu)
@@ -270,7 +270,7 @@ $.widget( "ui.autocomplete", {
                        .data( "menu" );
 
                if ( $.fn.bgiframe ) {
-                       this.menu.element.bgiframe();
+                        this.menu.element.bgiframe();
                }
 
                // turning off autocomplete prevents the browser from remembering the
index 701cb44d882cf34ecd12255e738f735d4d779a20..f84d748cf5bfb6b3b92d8e9f9523de1997d103ae 100644 (file)
@@ -186,7 +186,7 @@ $.widget( "ui.button", {
                                        if ( options.disabled ) {
                                                return false;
                                        }
-                                       if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {
+                                       if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
                                                $( this ).addClass( "ui-state-active" );
                                        }
                                })
@@ -212,6 +212,7 @@ $.widget( "ui.button", {
        },
 
        _determineButtonType: function() {
+               var ancestor, labelSelector, checked;
 
                if ( this.element.is(":checkbox") ) {
                        this.type = "checkbox";
@@ -226,8 +227,8 @@ $.widget( "ui.button", {
                if ( this.type === "checkbox" || this.type === "radio" ) {
                        // we don't search against the document in case the element
                        // is disconnected from the DOM
-                       var ancestor = this.element.parents().last(),
-                               labelSelector = "label[for='" + this.element.attr("id") + "']";
+                       ancestor = this.element.parents().last();
+                       labelSelector = "label[for='" + this.element.attr("id") + "']";
                        this.buttonElement = ancestor.find( labelSelector );
                        if ( !this.buttonElement.length ) {
                                ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
@@ -238,7 +239,7 @@ $.widget( "ui.button", {
                        }
                        this.element.addClass( "ui-helper-hidden-accessible" );
 
-                       var checked = this.element.is( ":checked" );
+                       checked = this.element.is( ":checked" );
                        if ( checked ) {
                                this.buttonElement.addClass( "ui-state-active" );
                        }
index f66b71c6efed518881aae91538a16eb73d032732..93353996ec4d5661db8b6e1e8d90a42be54c74b6 100644 (file)
@@ -165,11 +165,11 @@ $.each( [ "Width", "Height" ], function( i, name ) {
 
 // selectors
 function focusable( element, isTabIndexNotNaN ) {
-       var nodeName = element.nodeName.toLowerCase();
+       var map, mapName, img,
+               nodeName = element.nodeName.toLowerCase();
        if ( "area" === nodeName ) {
-               var map = element.parentNode,
-                       mapName = map.name,
-                       img;
+               map = element.parentNode;
+               mapName = map.name;
                if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
                        return false;
                }
@@ -178,7 +178,7 @@ function focusable( element, isTabIndexNotNaN ) {
        }
        return ( /input|select|textarea|button|object/.test( nodeName ) ?
                !element.disabled :
-               "a" == nodeName ?
+               "a" === nodeName ?
                        element.href || isTabIndexNotNaN :
                        isTabIndexNotNaN) &&
                // the element and all of its ancestors must be visible
@@ -242,19 +242,21 @@ $.extend( $.ui, {
        // $.ui.plugin is deprecated.  Use the proxy pattern instead.
        plugin: {
                add: function( module, option, set ) {
-                       var proto = $.ui[ module ].prototype;
-                       for ( var i in set ) {
+                       var i,
+                               proto = $.ui[ module ].prototype;
+                       for ( i in set ) {
                                proto.plugins[ i ] = proto.plugins[ i ] || [];
                                proto.plugins[ i ].push( [ option, set[ i ] ] );
                        }
                },
                call: function( instance, name, args ) {
-                       var set = instance.plugins[ name ];
+                       var i,
+                               set = instance.plugins[ name ];
                        if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) {
                                return;
                        }
        
-                       for ( var i = 0; i < set.length; i++ ) {
+                       for ( i = 0; i < set.length; i++ ) {
                                if ( instance.options[ set[ i ][ 0 ] ] ) {
                                        set[ i ][ 1 ].apply( instance.element, args );
                                }
index 053b26ab833bf134a8eb6e81a7cbed0fafd3b613..3a9bd5dc6c44c3656610055ff2e09b8c9060f101 100644 (file)
@@ -201,13 +201,13 @@ $.widget("ui.dialog", {
        },
 
        close: function( event ) {
-               if ( !this._isOpen ) {
-                       return self;
-               }
-
                var self = this,
                        maxZ, thisZ;
 
+               if ( !this._isOpen ) {
+                       return;
+               }
+
                if ( false === self._trigger( "beforeClose", event ) ) {
                        return;
                }
@@ -292,7 +292,8 @@ $.widget("ui.dialog", {
                        return;
                }
 
-               var self = this,
+               var hasFocus,
+                       self = this,
                        options = self.options,
                        uiDialog = self.uiDialog;
 
@@ -325,7 +326,7 @@ $.widget("ui.dialog", {
 
                // set focus to the first tabbable element in the content area or the first button
                // if there are no tabbable elements, set focus on the dialog itself
-               var hasFocus = self.element.find( ":tabbable" );
+               hasFocus = self.element.find( ":tabbable" );
                if ( !hasFocus.length ) {
                        hasFocus = uiDialog.find( ".ui-dialog-buttonpane :tabbable" );
                        if ( !hasFocus.length ) {
@@ -341,7 +342,8 @@ $.widget("ui.dialog", {
        },
 
        _createButtons: function( buttons ) {
-               var self = this,
+               var uiDialogButtonPane, uiButtonSet,
+                       self = this,
                        hasButtons = false;
 
                // if we already have a button pane, remove it
@@ -353,11 +355,11 @@ $.widget("ui.dialog", {
                        });
                }
                if ( hasButtons ) {
-                       var uiDialogButtonPane = $( "<div>" )
-                                       .addClass( "ui-dialog-buttonpane  ui-widget-content ui-helper-clearfix" ),
-                               uiButtonSet = $( "<div>" )
-                                       .addClass( "ui-dialog-buttonset" )
-                                       .appendTo( uiDialogButtonPane );
+                       uiDialogButtonPane = $( "<div>" )
+                               .addClass( "ui-dialog-buttonpane  ui-widget-content ui-helper-clearfix" );
+                       uiButtonSet = $( "<div>" )
+                               .addClass( "ui-dialog-buttonset" )
+                               .appendTo( uiDialogButtonPane );
 
                        $.each( buttons, function( name, props ) {
                                props = $.isFunction( props ) ?
@@ -547,7 +549,8 @@ $.widget("ui.dialog", {
        },
 
        _setOption: function( key, value ) {
-               var self = this,
+               var isDraggable, isResizable,
+                       self = this,
                        uiDialog = self.uiDialog;
 
                switch ( key ) {
@@ -571,7 +574,7 @@ $.widget("ui.dialog", {
                                }
                                break;
                        case "draggable":
-                               var isDraggable = uiDialog.is( ":data(draggable)" );
+                               isDraggable = uiDialog.is( ":data(draggable)" );
                                if ( isDraggable && !value ) {
                                        uiDialog.draggable( "destroy" );
                                }
@@ -585,7 +588,7 @@ $.widget("ui.dialog", {
                                break;
                        case "resizable":
                                // currently resizable, becoming non-resizable
-                               var isResizable = uiDialog.is( ":data(resizable)" );
+                               isResizable = uiDialog.is( ":data(resizable)" );
                                if ( isResizable && !value ) {
                                        uiDialog.resizable( "destroy" );
                                }
@@ -614,9 +617,8 @@ $.widget("ui.dialog", {
                /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
                 * divs will both have width and height set, so we need to reset them
                 */
-               var options = this.options,
-                       nonContentHeight,
-                       minContentHeight,
+               var nonContentHeight, minContentHeight, autoHeight,
+                       options = this.options,
                        isVisible = this.uiDialog.is( ":visible" );
 
                // reset content sizing
@@ -648,7 +650,7 @@ $.widget("ui.dialog", {
                                });
                        } else {
                                this.uiDialog.show();
-                               var autoHeight = this.element.css( "height", "auto" ).height();
+                               autoHeight = this.element.css( "height", "auto" ).height();
                                if ( !isVisible ) {
                                        this.uiDialog.hide();
                                }
@@ -740,7 +742,9 @@ $.extend( $.ui.dialog.overlay, {
        },
 
        destroy: function( $el ) {
-               var indexOf = $.inArray( $el, this.instances );
+               var indexOf = $.inArray( $el, this.instances ),
+                       maxZ = 0;
+
                if ( indexOf !== -1 ) {
                        this.oldInstances.push( this.instances.splice( indexOf, 1 )[ 0 ] );
                }
@@ -752,7 +756,6 @@ $.extend( $.ui.dialog.overlay, {
                $el.height( 0 ).width( 0 ).remove();
 
                // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
-               var maxZ = 0;
                $.each( this.instances, function() {
                        maxZ = Math.max( maxZ, this.css( "z-index" ) );
                });
index 6d00f66aec3690fc27f46bc3deb86cf676ca3d87..af22c19b02d4ea845bc7e2dd867b776bd0354d29 100644 (file)
@@ -85,9 +85,9 @@ $.widget( "ui.menu", {
                        "mouseleave": "collapseAll",
                        "mouseleave .ui-menu": "collapseAll",
                        "focus": function( event ) {
-                               var firstItem = this.element.children( ".ui-menu-item" ).not( ".ui-state-disabled" ).eq( 0 );
+                               var menu = this.element,
+                                       firstItem = menu.children( ".ui-menu-item" ).not( ".ui-state-disabled" ).eq( 0 );
                                if ( this._hasScroll() && !this.active ) {
-                                       var menu = this.element;
                                        menu.children().each( function() {
                                                var currentItem = $( this );
                                                if ( currentItem.offset().top - menu.offset().top >= 0 ) {
@@ -183,7 +183,7 @@ $.widget( "ui.menu", {
                                                character = String.fromCharCode( event.keyCode ),
                                                skip = false;
 
-                                       if (character == prev) {
+                                       if (character === prev) {
                                                skip = true;
                                        } else {
                                                character = prev + character;
@@ -195,7 +195,7 @@ $.widget( "ui.menu", {
                                                return new RegExp("^" + escape(character), "i")
                                                        .test( $( this ).children( "a" ).text() );
                                        });
-                                       match = skip && match.index(this.active.next()) != -1 ? this.active.nextAll(".ui-menu-item") : match;
+                                       match = skip && match.index(this.active.next()) !== -1 ? this.active.nextAll(".ui-menu-item") : match;
                                        if ( !match.length ) {
                                                character = String.fromCharCode(event.keyCode);
                                                match = this.activeMenu.children(".ui-menu-item").filter( function() {
@@ -260,15 +260,18 @@ $.widget( "ui.menu", {
 
        refresh: function() {
                // initialize nested menus
-               var submenus = this.element.find( this.options.menus + ":not( .ui-menu )" )
-                       .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
-                       .attr( "role", "menu" )
-                       .hide()
-                       .attr( "aria-hidden", "true" )
-                       .attr( "aria-expanded", "false" );
+               var menuId,
+                       submenus = this.element.find( this.options.menus + ":not( .ui-menu )" )
+                               .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+                               .hide()
+                               .attr({
+                                       role: "menu",
+                                       "aria-hidden": "true",
+                                       "aria-expanded": "false"
+                               });
 
                // don't refresh list items that are already adapted
-               var menuId = this.menuId;
+               menuId = this.menuId;
                submenus.add( this.element ).children( ":not( .ui-menu-item ):has( a )" )
                        .addClass( "ui-menu-item" )
                        .attr( "role", "presentation" )
@@ -291,15 +294,16 @@ $.widget( "ui.menu", {
        },
 
        focus: function( event, item ) {
+               var nested, borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
                this.blur( event );
 
                if ( this._hasScroll() ) {
-                       var borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0,
-                               paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0,
-                               offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop,
-                               scroll = this.activeMenu.scrollTop(),
-                               elementHeight = this.activeMenu.height(),
-                               itemHeight = item.height();
+                       borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
+                       paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
+                       offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
+                       scroll = this.activeMenu.scrollTop();
+                       elementHeight = this.activeMenu.height();
+                       itemHeight = item.height();
 
                        if ( offset < 0 ) {
                                this.activeMenu.scrollTop( scroll + offset );
@@ -321,7 +325,7 @@ $.widget( "ui.menu", {
                        this._close();
                }, this.delay );
 
-               var nested = $( "> .ui-menu", item );
+               nested = $( "> .ui-menu", item );
                if ( nested.length && ( /^mouse/.test( event.type ) ) ) {
                        this._startOpening(nested);
                }
@@ -368,7 +372,7 @@ $.widget( "ui.menu", {
 
                var position = $.extend({}, {
                                of: this.active
-                       }, $.type(this.options.position) == "function" ?
+                       }, $.type(this.options.position) === "function" ?
                                this.options.position(this.active) :
                                this.options.position
                        );
index 53b3dcc203d4eb0aa658504d7cc533eb29c96dd2..eaa953ad00608de370e6579ea488248916ce805d 100644 (file)
@@ -61,10 +61,10 @@ $.widget("ui.mouse", {
                this._mouseDownEvent = event;
 
                var that = this,
-                       btnIsLeft = (event.which == 1),
+                       btnIsLeft = (event.which === 1),
                        // event.target.nodeName works around a bug in IE 8 with
                        // disabled inputs (#7620)
-                       elIsCancel = (typeof this.options.cancel == "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
+                       elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
                if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
                        return true;
                }
@@ -134,7 +134,7 @@ $.widget("ui.mouse", {
                if (this._mouseStarted) {
                        this._mouseStarted = false;
 
-                       if (event.target == this._mouseDownEvent.target) {
+                       if (event.target === this._mouseDownEvent.target) {
                                $.data(event.target, this.widgetName + '.preventClickEvent', true);
                        }
 
index 1504e5bca22699d1e4afc404bbc917b31f2a9aea..68cccc55402514b65eef278c8250bc9474ad3e18 100644 (file)
@@ -85,8 +85,8 @@ $.widget( "ui.progressbar", {
        },
 
        _refreshValue: function() {
-               var value = this.value();
-               var percentage = this._percentage();
+               var value = this.value(),
+                       percentage = this._percentage();
 
                if ( this.oldValue !== value ) {
                        this.oldValue = value;
index a8bdb1948c0e49fad681d2081eb5e62a89bd768a..b355f8c7eb88a1923e824a6e5ddb21f81774b61a 100644 (file)
@@ -35,7 +35,8 @@ $.widget( "ui.slider", $.ui.mouse, {
        },
 
        _create: function() {
-               var self = this,
+               var i,
+                       self = this,
                        o = this.options,
                        existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
                        handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
@@ -78,7 +79,7 @@ $.widget( "ui.slider", $.ui.mouse, {
                                ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) );
                }
 
-               for ( var i = existingHandles.length; i < handleCount; i += 1 ) {
+               for ( i = existingHandles.length; i < handleCount; i++ ) {
                        handles.push( handle );
                }
 
index 45888220d03d52881746e70a65b340045f09b8f0..68c182c312d836353f81f44856ebeae40ceb2cb6 100644 (file)
@@ -20,13 +20,13 @@ function getNextTabId() {
        return ++tabId;
 }
 
-var isLocal = function( anchor ) {
+function isLocal( anchor ) {
        // clone the node to work around IE 6 not normalizing the href property
        // if it's manually set, i.e., a.href = "#foo" kills the normalization
        anchor = anchor.cloneNode( false );
        return anchor.hash.length > 1 &&
                        anchor.href.replace( rhash, "" ) === location.href.replace( rhash, "" );
-};
+}
 
 $.widget( "ui.tabs", {
        version: "@VERSION",
@@ -44,7 +44,8 @@ $.widget( "ui.tabs", {
        },
 
        _create: function() {
-               var that = this,
+               var panel,
+                       that = this,
                        options = that.options,
                        active = options.active;
 
@@ -110,7 +111,7 @@ $.widget( "ui.tabs", {
                // check for length avoids error when initializing empty list
                if ( options.active !== false && this.anchors.length ) {
                        this.active = this._findActive( options.active );
-                       var panel = that._getPanelForTab( this.active );
+                       panel = that._getPanelForTab( this.active );
 
                        panel.show();
                        this.lis.eq( options.active ).addClass( "ui-tabs-active ui-state-active" );
@@ -128,7 +129,7 @@ $.widget( "ui.tabs", {
        },
 
        _setOption: function( key, value ) {
-               if ( key == "active" ) {
+               if ( key === "active" ) {
                        // _activate() will handle invalid values and update this.options
                        this._activate( value );
                        return;
@@ -166,7 +167,8 @@ $.widget( "ui.tabs", {
        },
 
        refresh: function() {
-               var self = this,
+               var next,
+                       self = this,
                        options = this.options,
                        lis = this.list.children( ":has(a[href])" );
 
@@ -187,7 +189,7 @@ $.widget( "ui.tabs", {
                // was active, but active tab is gone
                } else if ( this.active.length && !$.contains( this.list[ 0 ], this.active[ 0 ] ) ) {
                        // activate previous tab
-                       var next = options.active - 1;
+                       next = options.active - 1;
                        this._activate( next >= 0 ? next : 0 );
                // was active, active tab still exists
                } else {
@@ -224,7 +226,7 @@ $.widget( "ui.tabs", {
                this.panels = $( [] );
 
                this.anchors.each(function( i, a ) {
-                       var selector, panel;
+                       var selector, panel, id;
 
                        // inline tab
                        if ( isLocal( a ) ) {
@@ -232,7 +234,7 @@ $.widget( "ui.tabs", {
                                panel = self.element.find( self._sanitizeSelector( selector ) );
                        // remote tab
                        } else {
-                               var id = self._tabId( a );
+                               id = self._tabId( a );
                                selector = "#" + id;
                                panel = self.element.find( selector );
                                if ( !panel.length ) {
@@ -433,7 +435,7 @@ $.widget( "ui.tabs", {
        _getIndex: function( index ) {
                // meta-function to give users option to provide a href string instead of a numerical index.
                // also sanitizes numerical indexes to valid values.
-               if ( typeof index == "string" ) {
+               if ( typeof index === "string" ) {
                        index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
                }
 
@@ -747,7 +749,8 @@ if ( $.uiBackCompat !== false ) {
                                index = this.anchors.length;
                        }
 
-                       var options = this.options,
+                       var doInsertAfter, panel,
+                               options = this.options,
                                li = $( options.tabTemplate
                                        .replace( /#\{href\}/g, url )
                                        .replace( /#\{label\}/g, label ) ),
@@ -758,10 +761,10 @@ if ( $.uiBackCompat !== false ) {
                        li.addClass( "ui-state-default ui-corner-top" ).data( "ui-tabs-destroy", true );
                        li.find( "a" ).attr( "aria-controls", id );
 
-                       var doInsertAfter = index >= this.lis.length;
+                       doInsertAfter = index >= this.lis.length;
 
                        // try to find an existing element before creating a new one
-                       var panel = this.element.find( "#" + id );
+                       panel = this.element.find( "#" + id );
                        if ( !panel.length ) {
                                panel = this._createPanel( id );
                                if ( doInsertAfter ) {
@@ -946,6 +949,8 @@ if ( $.uiBackCompat !== false ) {
        });
 
        // cookie option
+       (function() {
+
        var listId = 0;
 
        $.widget( "ui.tabs", $.ui.tabs, {
@@ -993,6 +998,8 @@ if ( $.uiBackCompat !== false ) {
                }
        });
 
+       })();
+
        // load event
        $.widget( "ui.tabs", $.ui.tabs, {
                _trigger: function( type, event, data ) {
index 46c5befaa74631e9423e1d8a78f4832bf7d3fe65..97895a6a8bec539289e96eeeba2549fe89bcd00b 100644 (file)
@@ -159,7 +159,7 @@ $.widget( "ui.tooltip", {
                        mouseleave: "close",
                        focusout: "close",
                        keyup: function( event ) {
-                               if ( event.keyCode == $.ui.keyCode.ESCAPE ) {
+                               if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
                                        var fakeEvent = $.Event(event);
                                        fakeEvent.currentTarget = target[0];
                                        this.close( fakeEvent, true );
index 1b7405e28b0114e4c1521fe7e93f5767563441cd..3e3723398d88ffc4ca1a2c7315cadbbc421a2b22 100644 (file)
@@ -9,9 +9,8 @@
  */
 (function( $, undefined ) {
 
-var slice = Array.prototype.slice;
-
-var _cleanData = $.cleanData;
+var slice = Array.prototype.slice,
+       _cleanData = $.cleanData;
 $.cleanData = function( elems ) {
        for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
                try {
@@ -73,11 +72,11 @@ $.widget = function( name, base, prototype ) {
                if ( $.isFunction( value ) ) {
                        prototype[ prop ] = (function() {
                                var _super = function() {
-                                       return base.prototype[ prop ].apply( this, arguments );
-                               };
-                               var _superApply = function( args ) {
-                                       return base.prototype[ prop ].apply( this, args );
-                               };
+                                               return base.prototype[ prop ].apply( this, arguments );
+                                       },
+                                       _superApply = function( args ) {
+                                               return base.prototype[ prop ].apply( this, args );
+                                       };
                                return function() {
                                        var __super = this._super,
                                                __superApply = this._superApply,
@@ -163,7 +162,8 @@ $.widget.bridge = function( name, object ) {
 
                if ( isMethodCall ) {
                        this.each(function() {
-                               var instance = $.data( this, fullName );
+                               var methodValue,
+                                       instance = $.data( this, fullName );
                                if ( !instance ) {
                                        return $.error( "cannot call methods on " + name + " prior to initialization; " +
                                                "attempted to call method '" + options + "'" );
@@ -171,7 +171,7 @@ $.widget.bridge = function( name, object ) {
                                if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
                                        return $.error( "no such method '" + options + "' for " + name + " widget instance" );
                                }
-                               var methodValue = instance[ options ].apply( instance, args );
+                               methodValue = instance[ options ].apply( instance, args );
                                if ( methodValue !== instance && methodValue !== undefined ) {
                                        returnValue = methodValue && methodValue.jquery ?
                                                returnValue.pushStack( methodValue.get() ) :