From ecde7cd41a59e9c3ff07f56baeeaec2147cca779 Mon Sep 17 00:00:00 2001 From: Jyoti Deka Date: Mon, 14 Oct 2013 23:43:06 -0400 Subject: Widget: option-method should work as getter only when argument length is 1. Fixes #9601 - Widget: calling _setOption with undefined as 3rd argument makes it a getter --- ui/jquery.ui.widget.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui') diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index a46dcaf99..cc01f784f 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -321,12 +321,12 @@ $.Widget.prototype = { curOption = curOption[ parts[ i ] ]; } key = parts.pop(); - if ( value === undefined ) { + if ( arguments.length === 1 ) { return curOption[ key ] === undefined ? null : curOption[ key ]; } curOption[ key ] = value; } else { - if ( value === undefined ) { + if ( arguments.length === 1 ) { return this.options[ key ] === undefined ? null : this.options[ key ]; } options[ key ] = value; -- cgit v1.2.3 From b715e1d3cc54245c54d3981aa341f3a812dba499 Mon Sep 17 00:00:00 2001 From: Jyoti Deka Date: Thu, 10 Oct 2013 13:27:29 -0400 Subject: Slider: Remove unnecessary 3rd argument in _slide method when calling this.values() --- ui/jquery.ui.slider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index e4f1cf7c9..df71f363f 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -322,7 +322,7 @@ $.widget( "ui.slider", $.ui.mouse, { } ); otherVal = this.values( index ? 0 : 1 ); if ( allowed !== false ) { - this.values( index, newVal, true ); + this.values( index, newVal ); } } } else { -- cgit v1.2.3 From 5ee3a2a7fdb7d49a5897b5f537d4e69d65bef6cb Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 18 Oct 2013 17:21:23 +0200 Subject: Revert "Slider: Remove unnecessary 3rd argument in _slide method when calling this.values()" This reverts commit b715e1d3cc54245c54d3981aa341f3a812dba499. Reverting to fix author email address to avoid CLA issues in the future. --- ui/jquery.ui.slider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index df71f363f..e4f1cf7c9 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -322,7 +322,7 @@ $.widget( "ui.slider", $.ui.mouse, { } ); otherVal = this.values( index ? 0 : 1 ); if ( allowed !== false ) { - this.values( index, newVal ); + this.values( index, newVal, true ); } } } else { -- cgit v1.2.3 From 93a2dcde527ac2511264b574b90f3bb1ce26cba7 Mon Sep 17 00:00:00 2001 From: Jyoti Deka Date: Fri, 18 Oct 2013 17:23:36 +0200 Subject: Slider: Remove unnecessary 3rd argument in _slide method when calling this.values() --- ui/jquery.ui.slider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index e4f1cf7c9..df71f363f 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -322,7 +322,7 @@ $.widget( "ui.slider", $.ui.mouse, { } ); otherVal = this.values( index ? 0 : 1 ); if ( allowed !== false ) { - this.values( index, newVal, true ); + this.values( index, newVal ); } } } else { -- cgit v1.2.3 From 06c4387bc94f0f71c202f8ce6b6a0551b8340506 Mon Sep 17 00:00:00 2001 From: Andrei Picus Date: Thu, 17 Oct 2013 17:20:11 +0300 Subject: Sortable: Fix typo and break lines in comment. --- ui/jquery.ui.sortable.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ui') diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index 9c7bf446c..c76a02397 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -354,12 +354,12 @@ $.widget("ui.sortable", $.ui.mouse, { } // Only put the placeholder inside the current Container, skip all - // items form other containers. This works because when moving + // items from other containers. This works because when moving // an item from one container to another the // currentContainer is switched before the placeholder is moved. // - // Without this moving items in "sub-sortables" can cause the placeholder to jitter - // beetween the outer and inner container. + // Without this, moving items in "sub-sortables" can cause + // the placeholder to jitter beetween the outer and inner container. if (item.instance !== this.currentContainer) { continue; } -- cgit v1.2.3 From 7b9c810b9ac450d826b6fa0c3d35377178b7e3b3 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 18 Oct 2013 15:39:20 +0200 Subject: Autocomplete: Append liveRegion to body to support detached init. Fixes #9590 - Dynamically adding input field breaks auto-complete's accessibility for screen readers --- tests/unit/autocomplete/autocomplete_core.js | 9 +++++++++ ui/jquery.ui.autocomplete.js | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/tests/unit/autocomplete/autocomplete_core.js b/tests/unit/autocomplete/autocomplete_core.js index a8b0a7330..58e96755a 100644 --- a/tests/unit/autocomplete/autocomplete_core.js +++ b/tests/unit/autocomplete/autocomplete_core.js @@ -257,6 +257,15 @@ test( "ARIA", function() { "Live region for multiple values" ); }); +test( "ARIA, init on detached input", function() { + expect( 1 ); + var element = $( "" ).autocomplete({ + source: [ "java", "javascript" ] + }), + liveRegion = element.autocomplete( "instance" ).liveRegion; + equal( liveRegion.parent().length, 1, "liveRegion must have a parent" ); +}); + test( ".replaceWith() (#9172)", function() { expect( 1 ); diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index d1a3c252d..2b803b62f 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -294,7 +294,7 @@ $.widget( "ui.autocomplete", { "aria-live": "polite" }) .addClass( "ui-helper-hidden-accessible" ) - .insertBefore( this.element ); + .appendTo( this.document[ 0 ].body ); // turning off autocomplete prevents the browser from remembering the // value when navigating through history, so we re-enable autocomplete -- cgit v1.2.3 From 14065dc23bb453b6c30138f225c9db728dd7e455 Mon Sep 17 00:00:00 2001 From: Kris Borchers Date: Tue, 15 Oct 2013 21:40:49 -0500 Subject: Resizable: Store size based on calculated helper size to prevent 1 pixel shifts. Fixes #9547 - Resizable: off-by-one pixel dimensions with helper and grid --- tests/unit/resizable/resizable_core.js | 15 +++++++++++++++ ui/jquery.ui.resizable.js | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/tests/unit/resizable/resizable_core.js b/tests/unit/resizable/resizable_core.js index 4cffea185..b02e8b4f1 100644 --- a/tests/unit/resizable/resizable_core.js +++ b/tests/unit/resizable/resizable_core.js @@ -191,4 +191,19 @@ test("resizable accounts for scroll position correctly (#3815)", function() { equal( el.css("top"), top, "css('top') stays the same when resized" ); }); +test( "resizable stores correct size when using helper and grid (#9547)", function() { + expect( 2 ); + + var handle = ".ui-resizable-se", + target = $( "#resizable1" ).resizable({ + handles: "all", + helper: "ui-resizable-helper", + grid: [ 10, 10 ] + }); + + TestHelpers.resizable.drag( handle, 1, 1 ); + equal( target.width(), 100, "compare width" ); + equal( target.height(), 100, "compare height" ); +}); + })(jQuery); diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js index aab93b57f..f683e6b65 100644 --- a/ui/jquery.ui.resizable.js +++ b/ui/jquery.ui.resizable.js @@ -316,7 +316,7 @@ $.widget("ui.resizable", $.ui.mouse, { //Store needed variables this.offset = this.helper.offset(); this.position = { left: curleft, top: curtop }; - this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; + this.size = this._helper ? { width: this.helper.width(), height: this.helper.height() } : { width: el.width(), height: el.height() }; this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; this.originalPosition = { left: curleft, top: curtop }; this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() }; -- cgit v1.2.3 From 52307ebadbca3f403549140e1d34f08bc07bf8ce Mon Sep 17 00:00:00 2001 From: Kris Borchers Date: Thu, 17 Oct 2013 23:07:39 -0500 Subject: Menu: More precise removal of ui-state-active class for easier CSS overrides. Fixes #9532 - Need a way in Menu to keep ui-state-active class on selected item --- tests/unit/menu/menu_core.js | 13 +++++++++++++ ui/jquery.ui.menu.js | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'ui') diff --git a/tests/unit/menu/menu_core.js b/tests/unit/menu/menu_core.js index 923d2961e..df039c9e4 100644 --- a/tests/unit/menu/menu_core.js +++ b/tests/unit/menu/menu_core.js @@ -45,4 +45,17 @@ asyncTest( "#9044: Autofocus issue with dialog opened from menu widget", functio }); }); +asyncTest( "#9532: Need a way in Menu to keep ui-state-active class on selected item for Selectmenu", function() { + expect( 1 ); + var element = $( "#menu1" ).menu(), + firstChild = element.children().eq( 0 ); + + element.menu( "focus", null, firstChild ); + firstChild.addClass( "ui-state-active" ); + setTimeout( function() { + ok( firstChild.is( ".ui-state-active" ), "ui-state-active improperly removed" ); + start(); + }, 500 ); +}); + })( jQuery ); diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 059f80b30..b0ff38894 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -371,7 +371,7 @@ $.widget( "ui.menu", { this._scrollIntoView( item ); this.active = item.first(); - focused = this.active.addClass( "ui-state-focus" ); + focused = this.active.addClass( "ui-state-focus" ).removeClass( "ui-state-active" ); // Only update aria-activedescendant if there's a role // otherwise we assume focus is managed elsewhere if ( this.options.role ) { @@ -498,7 +498,7 @@ $.widget( "ui.menu", { .attr( "aria-hidden", "true" ) .attr( "aria-expanded", "false" ) .end() - .find( ".ui-state-active" ) + .find( ".ui-state-active" ).not( ".ui-state-focus" ) .removeClass( "ui-state-active" ); }, -- cgit v1.2.3 From 94f8c4d5e9ef461973a504d65dd906c1120da71d Mon Sep 17 00:00:00 2001 From: Mike Sherov Date: Sun, 20 Oct 2013 19:33:40 -0400 Subject: Draggable: apply axis options to position instead of style. Fixes #7251 - Draggable: constrained axis option returns incorrect position. --- tests/unit/draggable/draggable_options.js | 22 ++++++++++++++++++---- ui/jquery.ui.draggable.js | 16 ++++++++++------ 2 files changed, 28 insertions(+), 10 deletions(-) (limited to 'ui') diff --git a/tests/unit/draggable/draggable_options.js b/tests/unit/draggable/draggable_options.js index be7d665d4..1d6f6eab5 100644 --- a/tests/unit/draggable/draggable_options.js +++ b/tests/unit/draggable/draggable_options.js @@ -106,14 +106,28 @@ test( "{ axis: false }, default", function() { }); test( "{ axis: 'x' }", function() { - expect( 2 ); - var element = $( "#draggable2" ).draggable({ axis: "x" }); + expect( 3 ); + var element = $( "#draggable2" ).draggable({ + axis: "x", + // TODO: remove the stop callback when all TestHelpers.draggable.testDrag bugs are fixed + stop: function( event, ui ) { + var expectedPosition = { left: ui.originalPosition.left + 50, top: ui.originalPosition.top }; + deepEqual( ui.position, expectedPosition, "position dragged[50,0] for axis: x" ); + } + }); TestHelpers.draggable.testDrag( element, element, 50, 50, 50, 0, "axis: x" ); }); test( "{ axis: 'y' }", function() { - expect( 2 ); - var element = $( "#draggable2" ).draggable({ axis: "y" }); + expect( 3 ); + var element = $( "#draggable2" ).draggable({ + axis: "y", + // TODO: remove the stop callback when all TestHelpers.draggable.testDrag bugs are fixed + stop: function( event, ui ) { + var expectedPosition = { left: ui.originalPosition.left, top: ui.originalPosition.top + 50 }; + deepEqual( ui.position, expectedPosition, "position dragged[0,50] for axis: y" ); + } + }); TestHelpers.draggable.testDrag( element, element, 50, 50, 0, 50, "axis: y" ); }); diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index 3b18f28f0..651dee3d7 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -221,12 +221,9 @@ $.widget("ui.draggable", $.ui.mouse, { this.position = ui.position; } - if(!this.options.axis || this.options.axis !== "y") { - this.helper[0].style.left = this.position.left+"px"; - } - if(!this.options.axis || this.options.axis !== "x") { - this.helper[0].style.top = this.position.top+"px"; - } + this.helper[ 0 ].style.left = this.position.left + "px"; + this.helper[ 0 ].style.top = this.position.top + "px"; + if($.ui.ddmanager) { $.ui.ddmanager.drag(this, event); } @@ -554,6 +551,13 @@ $.widget("ui.draggable", $.ui.mouse, { pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; } + if ( o.axis === "y" ) { + pageX = this.originalPageX; + } + + if ( o.axis === "x" ) { + pageY = this.originalPageY; + } } return { -- cgit v1.2.3 From 619261f0797a6fab49e2f2dd175b35795c0dc01e Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Mon, 21 Oct 2013 14:24:10 +0200 Subject: Datepicker: Finnish date format doesn't have padding for day and month. Fixes #9609 - Datepicker: Correct the Finnish date format --- ui/i18n/jquery.ui.datepicker-fi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/i18n/jquery.ui.datepicker-fi.js b/ui/i18n/jquery.ui.datepicker-fi.js index bd6d99498..e5c554aba 100644 --- a/ui/i18n/jquery.ui.datepicker-fi.js +++ b/ui/i18n/jquery.ui.datepicker-fi.js @@ -14,7 +14,7 @@ jQuery(function($){ dayNames: ['Sunnuntai','Maanantai','Tiistai','Keskiviikko','Torstai','Perjantai','Lauantai'], dayNamesMin: ['Su','Ma','Ti','Ke','To','Pe','La'], weekHeader: 'Vk', - dateFormat: 'dd.mm.yy', + dateFormat: 'd.m.yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, -- cgit v1.2.3 From 4bd1a9c5bae513974c294d41e778fc44777c8ed2 Mon Sep 17 00:00:00 2001 From: Mike Sherov Date: Mon, 21 Oct 2013 10:48:54 -0400 Subject: Draggable: Make sure positional constraints are never applied to ui.originalPosition --- ui/jquery.ui.draggable.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ui') diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index 651dee3d7..e528d194e 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -166,7 +166,7 @@ $.widget("ui.draggable", $.ui.mouse, { }); //Generate the original position - this.originalPosition = this.position = this._generatePosition(event); + this.originalPosition = this.position = this._generatePosition( event, false ); this.originalPageX = event.pageX; this.originalPageY = event.pageY; @@ -208,7 +208,7 @@ $.widget("ui.draggable", $.ui.mouse, { } //Compute the helpers position - this.position = this._generatePosition(event); + this.position = this._generatePosition( event, true ); this.positionAbs = this._convertPositionTo("absolute"); //Call plugins and callbacks and use the resulting position if something is returned @@ -488,7 +488,7 @@ $.widget("ui.draggable", $.ui.mouse, { }, - _generatePosition: function(event) { + _generatePosition: function( event, constrainPosition ) { var containment, co, top, left, o = this.options, @@ -513,7 +513,7 @@ $.widget("ui.draggable", $.ui.mouse, { */ // If we are not dragging yet, we won't check for options - if ( this.originalPosition ) { + if ( constrainPosition ) { if ( this.containment ) { if ( this.relative_container ){ co = this.relative_container.offset(); -- cgit v1.2.3