Merge changes Id1ac2f8b,I48f8cd17,I10481ce6,Id4530499
[lhc/web/wiklou.git] / resources / jquery.ui / jquery.ui.slider.js
index f02a922..23a56cc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * jQuery UI Slider 1.8.11
+ * jQuery UI Slider 1.8.18
  *
  * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
  * Dual licensed under the MIT or GPL Version 2 licenses.
@@ -36,7 +36,11 @@ $.widget( "ui.slider", $.ui.mouse, {
 
        _create: function() {
                var self = this,
-                       o = this.options;
+                       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>",
+                       handleCount = ( o.values && o.values.length ) || 1,
+                       handles = [];
 
                this._keySliding = false;
                this._mouseSliding = false;
@@ -50,57 +54,35 @@ $.widget( "ui.slider", $.ui.mouse, {
                                " ui-slider-" + this.orientation +
                                " ui-widget" +
                                " ui-widget-content" +
-                               " ui-corner-all" );
-               
-               if ( o.disabled ) {
-                       this.element.addClass( "ui-slider-disabled ui-disabled" );
-               }
+                               " ui-corner-all" +
+                               ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) );
 
                this.range = $([]);
 
                if ( o.range ) {
                        if ( o.range === true ) {
-                               this.range = $( "<div></div>" );
                                if ( !o.values ) {
                                        o.values = [ this._valueMin(), this._valueMin() ];
                                }
                                if ( o.values.length && o.values.length !== 2 ) {
                                        o.values = [ o.values[0], o.values[0] ];
                                }
-                       } else {
-                               this.range = $( "<div></div>" );
-                       }
-
-                       this.range
-                               .appendTo( this.element )
-                               .addClass( "ui-slider-range" );
-
-                       if ( o.range === "min" || o.range === "max" ) {
-                               this.range.addClass( "ui-slider-range-" + o.range );
                        }
 
-                       // note: this isn't the most fittingly semantic framework class for this element,
-                       // but worked best visually with a variety of themes
-                       this.range.addClass( "ui-widget-header" );
-               }
-
-               if ( $( ".ui-slider-handle", this.element ).length === 0 ) {
-                       $( "<a href='#'></a>" )
+                       this.range = $( "<div></div>" )
                                .appendTo( this.element )
-                               .addClass( "ui-slider-handle" );
+                               .addClass( "ui-slider-range" +
+                               // note: this isn't the most fittingly semantic framework class for this element,
+                               // but worked best visually with a variety of themes
+                               " ui-widget-header" + 
+                               ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) );
                }
 
-               if ( o.values && o.values.length ) {
-                       while ( $(".ui-slider-handle", this.element).length < o.values.length ) {
-                               $( "<a href='#'></a>" )
-                                       .appendTo( this.element )
-                                       .addClass( "ui-slider-handle" );
-                       }
+               for ( var i = existingHandles.length; i < handleCount; i += 1 ) {
+                       handles.push( handle );
                }
 
-               this.handles = $( ".ui-slider-handle", this.element )
-                       .addClass( "ui-state-default" +
-                               " ui-corner-all" );
+               this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( self.element ) );
 
                this.handle = this.handles.eq( 0 );
 
@@ -133,8 +115,7 @@ $.widget( "ui.slider", $.ui.mouse, {
 
                this.handles
                        .keydown(function( event ) {
-                               var ret = true,
-                                       index = $( this ).data( "index.ui-slider-handle" ),
+                               var index = $( this ).data( "index.ui-slider-handle" ),
                                        allowed,
                                        curVal,
                                        newVal,
@@ -153,7 +134,7 @@ $.widget( "ui.slider", $.ui.mouse, {
                                        case $.ui.keyCode.RIGHT:
                                        case $.ui.keyCode.DOWN:
                                        case $.ui.keyCode.LEFT:
-                                               ret = false;
+                                               event.preventDefault();
                                                if ( !self._keySliding ) {
                                                        self._keySliding = true;
                                                        $( this ).addClass( "ui-state-active" );
@@ -202,9 +183,6 @@ $.widget( "ui.slider", $.ui.mouse, {
                                }
        
                                self._slide( event, index, newVal );
-       
-                               return ret;
-       
                        })
                        .keyup(function( event ) {
                                var index = $( this ).data( "index.ui-slider-handle" );
@@ -466,6 +444,7 @@ $.widget( "ui.slider", $.ui.mouse, {
                        this.options.value = this._trimAlignValue( newValue );
                        this._refreshValue();
                        this._change( null, 0 );
+                       return;
                }
 
                return this._value();
@@ -480,6 +459,7 @@ $.widget( "ui.slider", $.ui.mouse, {
                        this.options.values[ index ] = this._trimAlignValue( newValue );
                        this._refreshValue();
                        this._change( null, index );
+                       return;
                }
 
                if ( arguments.length ) {
@@ -518,10 +498,10 @@ $.widget( "ui.slider", $.ui.mouse, {
                                if ( value ) {
                                        this.handles.filter( ".ui-state-focus" ).blur();
                                        this.handles.removeClass( "ui-state-hover" );
-                                       this.handles.attr( "disabled", "disabled" );
+                                       this.handles.propAttr( "disabled", true );
                                        this.element.addClass( "ui-disabled" );
                                } else {
-                                       this.handles.removeAttr( "disabled" );
+                                       this.handles.propAttr( "disabled", false );
                                        this.element.removeClass( "ui-disabled" );
                                }
                                break;
@@ -592,7 +572,7 @@ $.widget( "ui.slider", $.ui.mouse, {
                        return this._valueMax();
                }
                var step = ( this.options.step > 0 ) ? this.options.step : 1,
-                       valModStep = (val - this._valueMin()) % step;
+                       valModStep = (val - this._valueMin()) % step,
                        alignValue = val - valModStep;
 
                if ( Math.abs(valModStep) * 2 >= step ) {
@@ -676,7 +656,7 @@ $.widget( "ui.slider", $.ui.mouse, {
 });
 
 $.extend( $.ui.slider, {
-       version: "1.8.11"
+       version: "1.8.18"
 });
 
 }(jQuery));