From eef633e32a20ad93355060a8eef4b2129cf0bc5c Mon Sep 17 00:00:00 2001 From: Alex Rhea Date: Tue, 3 Jan 2012 13:00:02 -0500 Subject: [PATCH 01/15] Bug fix for isLocal function in jQuery Tabs. isLocal function was not compatible with HTML5 push state as the url could have changed since the page was loaded as in cases with Backbone.js --- ui/jquery.ui.tabs.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 5c9fc1326a..3e022af4a8 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -18,18 +18,13 @@ function getNextTabId() { return ++tabId; } -var isLocal = (function() { - var rhash = /#.*$/, - currentPage = location.href.replace( rhash, "" ); - - return function( 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, "" ) === currentPage; - }; -})(); +var isLocal = function( anchor ) { + var rhash = /#.*$/; + // 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", From 3c4e40d8d770ac117969b2cb011ac3d7402a134a Mon Sep 17 00:00:00 2001 From: Alex Rhea Date: Tue, 3 Jan 2012 13:18:13 -0500 Subject: [PATCH 02/15] Removed regex from function and split return into two lines. --- ui/jquery.ui.tabs.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 3e022af4a8..0429363f22 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -13,17 +13,19 @@ */ (function( $, undefined ) { -var tabId = 0; +var tabId = 0, + rhash = /#.*$/; + function getNextTabId() { return ++tabId; } var isLocal = function( anchor ) { - var rhash = /#.*$/; // 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, "" ); + return anchor.hash.length > 1 && + anchor.href.replace( rhash, "" ) === location.href.replace( rhash, "" ); }; $.widget( "ui.tabs", { From e2d9b02c56ee92fa92913b451598b59a385db609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Thu, 12 Jan 2012 08:59:34 -0500 Subject: [PATCH 03/15] Simulate: Define getters for pageX and pageY in mouse events if they come through as 0. Fixes #7324 - simulate mouse events broken for IE 9. --- tests/jquery.simulate.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tests/jquery.simulate.js b/tests/jquery.simulate.js index a37302c46c..a8740e6b8b 100644 --- a/tests/jquery.simulate.js +++ b/tests/jquery.simulate.js @@ -45,7 +45,7 @@ $.extend( $.simulate.prototype, { } }, mouseEvent: function( type, options ) { - var evt; + var evt, eventDoc, doc, body; var e = $.extend({ bubbles: true, cancelable: (type !== "mousemove"), @@ -71,6 +71,30 @@ $.extend( $.simulate.prototype, { e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget || document.body.parentNode ); + + // IE 9+ creates events with pageX and pageY set to 0. + // Trying to modify the properties throws an error, + // so we define getters to return the correct values. + if ( evt.pageX === 0 && evt.pageY === 0 && Object.defineProperty ) { + eventDoc = evt.relatedTarget.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + Object.defineProperty( evt, "pageX", { + get: function() { + return e.clientX + + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - + ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + } + }); + Object.defineProperty( evt, "pageY", { + get: function() { + return e.clientY + + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - + ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + }); + } } else if ( document.createEventObject ) { evt = document.createEventObject(); $.extend( evt, e ); From 82cf9e297fd78730dadd9a486d6871eca72455dd Mon Sep 17 00:00:00 2001 From: ryanolton Date: Thu, 12 Jan 2012 11:22:48 -0500 Subject: [PATCH 04/15] =?UTF-8?q?Datepicker:=20added=20check=20to=20accoun?= =?UTF-8?q?t=20for=20multiple=20pickers=20on=20one=20page.=20Fixed=20#5818?= =?UTF-8?q?=20=E2=80=93=20multiple=20DatePickers=20won't=20trigger=20close?= =?UTF-8?q?=20event?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/jquery.ui.datepicker.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index 45ddf8678e..5915d40277 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -233,7 +233,10 @@ $.extend(Datepicker.prototype, { inst.trigger.click(function() { if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0]) $.datepicker._hideDatepicker(); - else + else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) { + $.datepicker._hideDatepicker(); + $.datepicker._showDatepicker(input[0]); + } else $.datepicker._showDatepicker(input[0]); return false; }); From c0dfa1173c7427622a9f7573b173211f6b594a5f Mon Sep 17 00:00:00 2001 From: clear00 <386@mail.com> Date: Fri, 13 Jan 2012 05:01:01 +0900 Subject: [PATCH 05/15] Datepicker i18n: Fix monthNames, monthNamesShort, dayNames, showMonthAfterYear on the Korean translation . Fixed #8010 - Datepicker i18n: Fix some issues on the Korean translation --- ui/i18n/jquery.ui.datepicker-ko.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/i18n/jquery.ui.datepicker-ko.js b/ui/i18n/jquery.ui.datepicker-ko.js index 5b3531652d..04112424da 100644 --- a/ui/i18n/jquery.ui.datepicker-ko.js +++ b/ui/i18n/jquery.ui.datepicker-ko.js @@ -1,23 +1,23 @@ /* Korean initialisation for the jQuery calendar extension. */ -/* Written by DaeKwon Kang (ncrash.dk@gmail.com). */ +/* Written by DaeKwon Kang (ncrash.dk@gmail.com), Edited by Genie. */ jQuery(function($){ $.datepicker.regional['ko'] = { closeText: '닫기', prevText: '이전달', nextText: '다음달', currentText: '오늘', - monthNames: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)', - '7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'], - monthNamesShort: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)', - '7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'], - dayNames: ['일','월','화','수','목','금','토'], + monthNames: ['1월','2월','3월','4월','5월','6월', + '7월','8월','9월','10월','11월','12월'], + monthNamesShort: ['1월','2월','3월','4월','5월','6월', + '7월','8월','9월','10월','11월','12월'], + dayNames: ['일요일','월요일','화요일','수요일','목요일','금요일','토요일'], dayNamesShort: ['일','월','화','수','목','금','토'], dayNamesMin: ['일','월','화','수','목','금','토'], weekHeader: 'Wk', dateFormat: 'yy-mm-dd', firstDay: 0, isRTL: false, - showMonthAfterYear: false, + showMonthAfterYear: true, yearSuffix: '년'}; $.datepicker.setDefaults($.datepicker.regional['ko']); }); \ No newline at end of file From eee63a2e2435a6ecbcd0daa15f41b7bd5901e307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Thu, 12 Jan 2012 16:49:50 -0500 Subject: [PATCH 06/15] Datepicker i18n (nl-BE): Removed BOM. --- ui/i18n/jquery.ui.datepicker-nl-BE.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/i18n/jquery.ui.datepicker-nl-BE.js b/ui/i18n/jquery.ui.datepicker-nl-BE.js index 56207cb04d..7b3cdf425b 100644 --- a/ui/i18n/jquery.ui.datepicker-nl-BE.js +++ b/ui/i18n/jquery.ui.datepicker-nl-BE.js @@ -1,4 +1,4 @@ -/* Dutch (Belgium) initialisation for the jQuery UI date picker plugin. */ +/* Dutch (Belgium) initialisation for the jQuery UI date picker plugin. */ /* David De Sloovere @DavidDeSloovere */ jQuery(function($){ $.datepicker.regional['nl-BE'] = { @@ -20,4 +20,4 @@ jQuery(function($){ showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['nl-BE']); -}); \ No newline at end of file +}); From 3a1031e58b717b042d39dcccfdbe1d293cdbecf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Wed, 18 Jan 2012 16:37:04 -0500 Subject: [PATCH 07/15] Button: Properly handle disabled option on init. Fixes #8028 - Getting unset disabled option on button widget returns jQuery object, not default value. --- ui/jquery.ui.button.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index 18a9505633..1c3cf2c645 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -58,7 +58,9 @@ $.widget( "ui.button", { .bind( "reset.button", formResetHandler ); if ( typeof this.options.disabled !== "boolean" ) { - this.options.disabled = this.element.prop( "disabled" ); + this.options.disabled = !!this.element.prop( "disabled" ); + } else { + this.element.prop( "disabled", this.options.disabled ); } this._determineButtonType(); @@ -74,10 +76,6 @@ $.widget( "ui.button", { options.label = this.buttonElement.html(); } - if ( this.element.is( ":disabled" ) ) { - options.disabled = true; - } - this.buttonElement .addClass( baseClasses ) .attr( "role", "button" ) From 13eca299a9a7fb9767a9685f50d4242cc3ad7d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Wed, 18 Jan 2012 16:51:43 -0500 Subject: [PATCH 08/15] Menu tests: Removed trigger option. --- tests/unit/menu/menu_defaults.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/unit/menu/menu_defaults.js b/tests/unit/menu/menu_defaults.js index 3d7ec297f0..bf41fb999f 100644 --- a/tests/unit/menu/menu_defaults.js +++ b/tests/unit/menu/menu_defaults.js @@ -1,12 +1,11 @@ commonWidgetTests( "menu", { defaults: { disabled: false, + menus: "ul", position: { my: "left top", at: "right top" }, - menus: "ul", - trigger: null, // callbacks create: null From 07ec849f623699c87fc7ecc3770ea11ad9ba8e4e Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Wed, 18 Jan 2012 18:58:43 -0500 Subject: [PATCH 09/15] Position: Update fullname reference; jQuery => $. Fixes #8029 - Position: There is a reference to the global jQuery variable. --- ui/jquery.ui.position.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index 9a520f8453..00976bf791 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -37,7 +37,7 @@ $.position = { div.remove(); - return w1 - w2; + return w1 - w2; }, getScrollInfo: function(within) { var notWindow = within[0] !== window, @@ -401,12 +401,12 @@ $.ui.position = { } }, flipfit: { - left: function() { - $.ui.position.flip.left.apply( this, arguments ); + left: function() { + $.ui.position.flip.left.apply( this, arguments ); $.ui.position.fit.left.apply( this, arguments ); }, - top: function() { - $.ui.position.flip.top.apply( this, arguments ); + top: function() { + $.ui.position.flip.top.apply( this, arguments ); $.ui.position.fit.top.apply( this, arguments ); } } @@ -415,7 +415,7 @@ $.ui.position = { // fraction support test (function () { var testElement, testElementParent, testElementStyle, offsetLeft, i - body = document.getElementsByTagName( "body" )[ 0 ], + body = document.getElementsByTagName( "body" )[ 0 ], div = document.createElement( "div" ); //Create a "fake body" for testing based on method used in jQuery.support @@ -429,7 +429,7 @@ $.ui.position = { background: "none" }; if ( body ) { - jQuery.extend( testElementStyle, { + $.extend( testElementStyle, { position: "absolute", left: "-1000px", top: "-1000px" From 956c2cd2a5a44d40a9b2fb0a8c05f765fa302c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Thu, 19 Jan 2012 21:37:21 -0500 Subject: [PATCH 10/15] Core: Access offsetHeight on div for support tests to avoid a layout bug in IE 9. Fixes #8026 - minHeight support test affects page layout in IE 9. --- ui/jquery.ui.core.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js index f0cf89ba76..d777d6d498 100644 --- a/ui/jquery.ui.core.js +++ b/ui/jquery.ui.core.js @@ -223,6 +223,11 @@ $(function() { var body = document.body, div = body.appendChild( div = document.createElement( "div" ) ); + // access offsetHeight before setting the style to prevent a layout bug + // in IE 9 which causes the elemnt to continue to take up space even + // after it is removed from the DOM (#8026) + div.offsetHeight; + $.extend( div.style, { minHeight: "100px", height: "auto", From ba6916f22ac3fac993975abc0f86d6cb0bf9c08d Mon Sep 17 00:00:00 2001 From: SpoonNZ Date: Fri, 20 Jan 2012 16:54:47 +1300 Subject: [PATCH 11/15] Sortable: Added a variable to track if initialization is complete. Fixes #4759 - a major optimization is possible in sortable(). --- ui/jquery.ui.sortable.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index 62d227a3d2..6005694515 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -17,6 +17,7 @@ $.widget("ui.sortable", $.ui.mouse, { version: "@VERSION", widgetEventPrefix: "sort", + ready: false, options: { appendTo: "parent", axis: false, @@ -58,6 +59,9 @@ $.widget("ui.sortable", $.ui.mouse, { //Initialize mouse events for interaction this._mouseInit(); + + //We're ready to go + this.ready = true }, @@ -571,7 +575,7 @@ $.widget("ui.sortable", $.ui.mouse, { var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]]; var connectWith = this._connectWith(); - if(connectWith) { + if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down for (var i = connectWith.length - 1; i >= 0; i--){ var cur = $(connectWith[i]); for (var j = cur.length - 1; j >= 0; j--){ From b7af203c8e9db1d253bca7aeb66350280402ca1c Mon Sep 17 00:00:00 2001 From: stojce Date: Mon, 5 Dec 2011 09:59:42 +0100 Subject: [PATCH 12/15] Datepicker i18n: Fixed Macedonian date format. Fixes #8040 - Datepicker: Macedonian locale has incorrect date format. --- ui/i18n/jquery.ui.datepicker-mk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/i18n/jquery.ui.datepicker-mk.js b/ui/i18n/jquery.ui.datepicker-mk.js index 554ad20ba3..1e602427af 100644 --- a/ui/i18n/jquery.ui.datepicker-mk.js +++ b/ui/i18n/jquery.ui.datepicker-mk.js @@ -14,7 +14,7 @@ jQuery(function($){ dayNamesShort: ['Нед','Пон','Вто','Сре','Чет','Пет','Саб'], dayNamesMin: ['Не','По','Вт','Ср','Че','Пе','Са'], weekHeader: 'Сед', - dateFormat: 'dd/mm/yy', + dateFormat: 'dd.mm.yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, From 0cf6bc042938a11abc09ed4e575c8792585607ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Sat, 21 Jan 2012 08:04:39 -0500 Subject: [PATCH 13/15] Tabs: Move logic for finding the tab list into its own function to allow overriding for rare usage scenarios. --- ui/jquery.ui.tabs.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 0429363f22..168aa0ee55 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -209,7 +209,7 @@ $.widget( "ui.tabs", { _processTabs: function() { var self = this; - this.list = this.element.find( "ol,ul" ).eq( 0 ); + this.list = this._getList(); this.lis = $( " > li:has(a[href])", this.list ); this.anchors = this.lis.map(function() { return $( "a", this )[ 0 ]; @@ -241,6 +241,11 @@ $.widget( "ui.tabs", { }); }, + // allow overriding how to find the list for rare usage scenarios (#7715) + _getList: function() { + return this.element.find( "ol,ul" ).eq( 0 ); + }, + _createPanel: function( id ) { return $( "
" ) .attr( "id", id ) From da89fcbc07f236d43e6a1edd98603beea6e245b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Sat, 21 Jan 2012 08:45:41 -0500 Subject: [PATCH 14/15] Widget: Added _getCreateEventData(). Fixes #8045 - Widget: Ability to provide event data for create event. --- tests/unit/widget/widget_core.js | 15 +++++++++++++++ ui/jquery.ui.widget.js | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js index 2e55ad7031..df83abe91b 100644 --- a/tests/unit/widget/widget_core.js +++ b/tests/unit/widget/widget_core.js @@ -261,6 +261,21 @@ test( "._getCreateOptions()", function() { $( "
" ).testWidget({ option2: "value2" }); }); +test( "._getCreateEventData()", function() { + expect( 1 ); + var data = { foo: "bar" }; + $.widget( "ui.testWidget", { + _getCreateEventData: function() { + return data; + } + }); + $( "
" ).testWidget({ + create: function( event, ui ) { + strictEqual( ui, data, "event data" ); + } + }); +}); + test( "re-init", function() { var div = $( "
" ), actions = []; diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 5c8560bfd3..ad03e6f44a 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -204,10 +204,11 @@ $.Widget.prototype = { } this._create(); - this._trigger( "create" ); + this._trigger( "create", null, this._getCreateEventData() ); this._init(); }, _getCreateOptions: $.noop, + _getCreateEventData: $.noop, _create: $.noop, _init: $.noop, From 6800e1a2f97a7d8aaf20d065aa2ce517528e5068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Sat, 21 Jan 2012 08:46:02 -0500 Subject: [PATCH 15/15] Tabs: Pass tab and panel in create event. Fixes #7868 - Tabs: Provide tab and panel details in create event. --- tests/unit/tabs/tabs_events.js | 39 ++++++++++++++++++++++++++++++++++ ui/jquery.ui.tabs.js | 7 ++++++ 2 files changed, 46 insertions(+) diff --git a/tests/unit/tabs/tabs_events.js b/tests/unit/tabs/tabs_events.js index f5cde180bb..3335789079 100644 --- a/tests/unit/tabs/tabs_events.js +++ b/tests/unit/tabs/tabs_events.js @@ -2,6 +2,45 @@ module( "tabs: events" ); +test( "create", function() { + expect( 10 ); + + var element = $( "#tabs1" ), + tabs = element.find( "ul a" ), + panels = element.children( "div" ); + + element.tabs({ + create: function( event, ui ) { + equals( ui.tab.size(), 1, "tab size" ); + strictEqual( ui.tab[ 0 ], tabs[ 0 ], "tab" ); + equals( ui.panel.size(), 1, "panel size" ); + strictEqual( ui.panel[ 0 ], panels[ 0 ], "panel" ); + } + }); + element.tabs( "destroy" ); + + element.tabs({ + active: 2, + create: function( event, ui ) { + equals( ui.tab.size(), 1, "tab size" ); + strictEqual( ui.tab[ 0 ], tabs[ 2 ], "tab" ); + equals( ui.panel.size(), 1, "panel size" ); + strictEqual( ui.panel[ 0 ], panels[ 2 ], "panel" ); + } + }); + element.tabs( "destroy" ); + + element.tabs({ + active: false, + collapsible: true, + create: function( event, ui ) { + equals( ui.tab.size(), 0, "tab size" ); + equals( ui.panel.size(), 0, "panel size" ); + } + }); + element.tabs( "destroy" ); +}); + test( "beforeActivate", function() { expect( 38 ); diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 168aa0ee55..7a701405ca 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -120,6 +120,13 @@ $.widget( "ui.tabs", { } }, + _getCreateEventData: function() { + return { + tab: this.active, + panel: !this.active.length ? $() : this._getPanelForTab( this.active ) + }; + }, + _setOption: function( key, value ) { if ( key == "active" ) { // _activate() will handle invalid values and update this.options