Skip to content

Commit 21d96f1

Browse files
committed
Merge branch 'master' of github.com:jquery/jquery-ui into selectmenu
2 parents 725023e + 6800e1a commit 21d96f1

14 files changed

+139
-42
lines changed

tests/jquery.simulate.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ $.extend( $.simulate.prototype, {
4545
}
4646
},
4747
mouseEvent: function( type, options ) {
48-
var evt;
48+
var evt, eventDoc, doc, body;
4949
var e = $.extend({
5050
bubbles: true,
5151
cancelable: (type !== "mousemove"),
@@ -71,6 +71,30 @@ $.extend( $.simulate.prototype, {
7171
e.screenX, e.screenY, e.clientX, e.clientY,
7272
e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
7373
e.button, e.relatedTarget || document.body.parentNode );
74+
75+
// IE 9+ creates events with pageX and pageY set to 0.
76+
// Trying to modify the properties throws an error,
77+
// so we define getters to return the correct values.
78+
if ( evt.pageX === 0 && evt.pageY === 0 && Object.defineProperty ) {
79+
eventDoc = evt.relatedTarget.ownerDocument || document;
80+
doc = eventDoc.documentElement;
81+
body = eventDoc.body;
82+
83+
Object.defineProperty( evt, "pageX", {
84+
get: function() {
85+
return e.clientX +
86+
( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) -
87+
( doc && doc.clientLeft || body && body.clientLeft || 0 );
88+
}
89+
});
90+
Object.defineProperty( evt, "pageY", {
91+
get: function() {
92+
return e.clientY +
93+
( doc && doc.scrollTop || body && body.scrollTop || 0 ) -
94+
( doc && doc.clientTop || body && body.clientTop || 0 );
95+
}
96+
});
97+
}
7498
} else if ( document.createEventObject ) {
7599
evt = document.createEventObject();
76100
$.extend( evt, e );

tests/unit/menu/menu_defaults.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
commonWidgetTests( "menu", {
22
defaults: {
33
disabled: false,
4+
menus: "ul",
45
position: {
56
my: "left top",
67
at: "right top"
78
},
8-
menus: "ul",
9-
trigger: null,
109

1110
// callbacks
1211
create: null

tests/unit/tabs/tabs_events.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,45 @@
22

33
module( "tabs: events" );
44

5+
test( "create", function() {
6+
expect( 10 );
7+
8+
var element = $( "#tabs1" ),
9+
tabs = element.find( "ul a" ),
10+
panels = element.children( "div" );
11+
12+
element.tabs({
13+
create: function( event, ui ) {
14+
equals( ui.tab.size(), 1, "tab size" );
15+
strictEqual( ui.tab[ 0 ], tabs[ 0 ], "tab" );
16+
equals( ui.panel.size(), 1, "panel size" );
17+
strictEqual( ui.panel[ 0 ], panels[ 0 ], "panel" );
18+
}
19+
});
20+
element.tabs( "destroy" );
21+
22+
element.tabs({
23+
active: 2,
24+
create: function( event, ui ) {
25+
equals( ui.tab.size(), 1, "tab size" );
26+
strictEqual( ui.tab[ 0 ], tabs[ 2 ], "tab" );
27+
equals( ui.panel.size(), 1, "panel size" );
28+
strictEqual( ui.panel[ 0 ], panels[ 2 ], "panel" );
29+
}
30+
});
31+
element.tabs( "destroy" );
32+
33+
element.tabs({
34+
active: false,
35+
collapsible: true,
36+
create: function( event, ui ) {
37+
equals( ui.tab.size(), 0, "tab size" );
38+
equals( ui.panel.size(), 0, "panel size" );
39+
}
40+
});
41+
element.tabs( "destroy" );
42+
});
43+
544
test( "beforeActivate", function() {
645
expect( 38 );
746

tests/unit/widget/widget_core.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,21 @@ test( "._getCreateOptions()", function() {
261261
$( "<div>" ).testWidget({ option2: "value2" });
262262
});
263263

264+
test( "._getCreateEventData()", function() {
265+
expect( 1 );
266+
var data = { foo: "bar" };
267+
$.widget( "ui.testWidget", {
268+
_getCreateEventData: function() {
269+
return data;
270+
}
271+
});
272+
$( "<div>" ).testWidget({
273+
create: function( event, ui ) {
274+
strictEqual( ui, data, "event data" );
275+
}
276+
});
277+
});
278+
264279
test( "re-init", function() {
265280
var div = $( "<div>" ),
266281
actions = [];

ui/i18n/jquery.ui.datepicker-ko.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
/* Korean initialisation for the jQuery calendar extension. */
2-
/* Written by DaeKwon Kang (ncrash.dk@gmail.com). */
2+
/* Written by DaeKwon Kang (ncrash.dk@gmail.com), Edited by Genie. */
33
jQuery(function($){
44
$.datepicker.regional['ko'] = {
55
closeText: '닫기',
66
prevText: '이전달',
77
nextText: '다음달',
88
currentText: '오늘',
9-
monthNames: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)',
10-
'7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'],
11-
monthNamesShort: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)',
12-
'7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'],
13-
dayNames: ['','','','','','',''],
9+
monthNames: ['1월','2월','3월','4월','5월','6월',
10+
'7월','8월','9월','10월','11월','12월'],
11+
monthNamesShort: ['1월','2월','3월','4월','5월','6월',
12+
'7월','8월','9월','10월','11월','12월'],
13+
dayNames: ['일요일','월요일','화요일','수요일','목요일','금요일','토요일'],
1414
dayNamesShort: ['일','월','화','수','목','금','토'],
1515
dayNamesMin: ['일','월','화','수','목','금','토'],
1616
weekHeader: 'Wk',
1717
dateFormat: 'yy-mm-dd',
1818
firstDay: 0,
1919
isRTL: false,
20-
showMonthAfterYear: false,
20+
showMonthAfterYear: true,
2121
yearSuffix: '년'};
2222
$.datepicker.setDefaults($.datepicker.regional['ko']);
2323
});

ui/i18n/jquery.ui.datepicker-mk.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jQuery(function($){
1414
dayNamesShort: ['Нед','Пон','Вто','Сре','Чет','Пет','Саб'],
1515
dayNamesMin: ['Не','По','Вт','Ср','Че','Пе','Са'],
1616
weekHeader: 'Сед',
17-
dateFormat: 'dd/mm/yy',
17+
dateFormat: 'dd.mm.yy',
1818
firstDay: 1,
1919
isRTL: false,
2020
showMonthAfterYear: false,

ui/i18n/jquery.ui.datepicker-nl-BE.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Dutch (Belgium) initialisation for the jQuery UI date picker plugin. */
1+
/* Dutch (Belgium) initialisation for the jQuery UI date picker plugin. */
22
/* David De Sloovere @DavidDeSloovere */
33
jQuery(function($){
44
$.datepicker.regional['nl-BE'] = {
@@ -20,4 +20,4 @@ jQuery(function($){
2020
showMonthAfterYear: false,
2121
yearSuffix: ''};
2222
$.datepicker.setDefaults($.datepicker.regional['nl-BE']);
23-
});
23+
});

ui/jquery.ui.button.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ $.widget( "ui.button", {
5858
.bind( "reset.button", formResetHandler );
5959

6060
if ( typeof this.options.disabled !== "boolean" ) {
61-
this.options.disabled = this.element.prop( "disabled" );
61+
this.options.disabled = !!this.element.prop( "disabled" );
62+
} else {
63+
this.element.prop( "disabled", this.options.disabled );
6264
}
6365

6466
this._determineButtonType();
@@ -74,10 +76,6 @@ $.widget( "ui.button", {
7476
options.label = this.buttonElement.html();
7577
}
7678

77-
if ( this.element.is( ":disabled" ) ) {
78-
options.disabled = true;
79-
}
80-
8179
this.buttonElement
8280
.addClass( baseClasses )
8381
.attr( "role", "button" )

ui/jquery.ui.core.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ $(function() {
223223
var body = document.body,
224224
div = body.appendChild( div = document.createElement( "div" ) );
225225

226+
// access offsetHeight before setting the style to prevent a layout bug
227+
// in IE 9 which causes the elemnt to continue to take up space even
228+
// after it is removed from the DOM (#8026)
229+
div.offsetHeight;
230+
226231
$.extend( div.style, {
227232
minHeight: "100px",
228233
height: "auto",

ui/jquery.ui.datepicker.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,10 @@ $.extend(Datepicker.prototype, {
233233
inst.trigger.click(function() {
234234
if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
235235
$.datepicker._hideDatepicker();
236-
else
236+
else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) {
237+
$.datepicker._hideDatepicker();
238+
$.datepicker._showDatepicker(input[0]);
239+
} else
237240
$.datepicker._showDatepicker(input[0]);
238241
return false;
239242
});

ui/jquery.ui.position.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $.position = {
3737

3838
div.remove();
3939

40-
return w1 - w2;
40+
return w1 - w2;
4141
},
4242
getScrollInfo: function(within) {
4343
var notWindow = within[0] !== window,
@@ -401,12 +401,12 @@ $.ui.position = {
401401
}
402402
},
403403
flipfit: {
404-
left: function() {
405-
$.ui.position.flip.left.apply( this, arguments );
404+
left: function() {
405+
$.ui.position.flip.left.apply( this, arguments );
406406
$.ui.position.fit.left.apply( this, arguments );
407407
},
408-
top: function() {
409-
$.ui.position.flip.top.apply( this, arguments );
408+
top: function() {
409+
$.ui.position.flip.top.apply( this, arguments );
410410
$.ui.position.fit.top.apply( this, arguments );
411411
}
412412
}
@@ -415,7 +415,7 @@ $.ui.position = {
415415
// fraction support test
416416
(function () {
417417
var testElement, testElementParent, testElementStyle, offsetLeft, i
418-
body = document.getElementsByTagName( "body" )[ 0 ],
418+
body = document.getElementsByTagName( "body" )[ 0 ],
419419
div = document.createElement( "div" );
420420

421421
//Create a "fake body" for testing based on method used in jQuery.support
@@ -429,7 +429,7 @@ $.ui.position = {
429429
background: "none"
430430
};
431431
if ( body ) {
432-
jQuery.extend( testElementStyle, {
432+
$.extend( testElementStyle, {
433433
position: "absolute",
434434
left: "-1000px",
435435
top: "-1000px"

ui/jquery.ui.sortable.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
$.widget("ui.sortable", $.ui.mouse, {
1818
version: "@VERSION",
1919
widgetEventPrefix: "sort",
20+
ready: false,
2021
options: {
2122
appendTo: "parent",
2223
axis: false,
@@ -58,6 +59,9 @@ $.widget("ui.sortable", $.ui.mouse, {
5859

5960
//Initialize mouse events for interaction
6061
this._mouseInit();
62+
63+
//We're ready to go
64+
this.ready = true
6165

6266
},
6367

@@ -571,7 +575,7 @@ $.widget("ui.sortable", $.ui.mouse, {
571575
var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
572576
var connectWith = this._connectWith();
573577

574-
if(connectWith) {
578+
if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
575579
for (var i = connectWith.length - 1; i >= 0; i--){
576580
var cur = $(connectWith[i]);
577581
for (var j = cur.length - 1; j >= 0; j--){

ui/jquery.ui.tabs.js

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,20 @@
1313
*/
1414
(function( $, undefined ) {
1515

16-
var tabId = 0;
16+
var tabId = 0,
17+
rhash = /#.*$/;
18+
1719
function getNextTabId() {
1820
return ++tabId;
1921
}
2022

21-
var isLocal = (function() {
22-
var rhash = /#.*$/,
23-
currentPage = location.href.replace( rhash, "" );
24-
25-
return function( anchor ) {
26-
// clone the node to work around IE 6 not normalizing the href property
27-
// if it's manually set, i.e., a.href = "#foo" kills the normalization
28-
anchor = anchor.cloneNode( false );
29-
return anchor.hash.length > 1 &&
30-
anchor.href.replace( rhash, "" ) === currentPage;
31-
};
32-
})();
23+
var isLocal = function( anchor ) {
24+
// clone the node to work around IE 6 not normalizing the href property
25+
// if it's manually set, i.e., a.href = "#foo" kills the normalization
26+
anchor = anchor.cloneNode( false );
27+
return anchor.hash.length > 1 &&
28+
anchor.href.replace( rhash, "" ) === location.href.replace( rhash, "" );
29+
};
3330

3431
$.widget( "ui.tabs", {
3532
version: "@VERSION",
@@ -123,6 +120,13 @@ $.widget( "ui.tabs", {
123120
}
124121
},
125122

123+
_getCreateEventData: function() {
124+
return {
125+
tab: this.active,
126+
panel: !this.active.length ? $() : this._getPanelForTab( this.active )
127+
};
128+
},
129+
126130
_setOption: function( key, value ) {
127131
if ( key == "active" ) {
128132
// _activate() will handle invalid values and update this.options
@@ -212,7 +216,7 @@ $.widget( "ui.tabs", {
212216
_processTabs: function() {
213217
var self = this;
214218

215-
this.list = this.element.find( "ol,ul" ).eq( 0 );
219+
this.list = this._getList();
216220
this.lis = $( " > li:has(a[href])", this.list );
217221
this.anchors = this.lis.map(function() {
218222
return $( "a", this )[ 0 ];
@@ -244,6 +248,11 @@ $.widget( "ui.tabs", {
244248
});
245249
},
246250

251+
// allow overriding how to find the list for rare usage scenarios (#7715)
252+
_getList: function() {
253+
return this.element.find( "ol,ul" ).eq( 0 );
254+
},
255+
247256
_createPanel: function( id ) {
248257
return $( "<div></div>" )
249258
.attr( "id", id )

ui/jquery.ui.widget.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,11 @@ $.Widget.prototype = {
204204
}
205205

206206
this._create();
207-
this._trigger( "create" );
207+
this._trigger( "create", null, this._getCreateEventData() );
208208
this._init();
209209
},
210210
_getCreateOptions: $.noop,
211+
_getCreateEventData: $.noop,
211212
_create: $.noop,
212213
_init: $.noop,
213214

0 commit comments

Comments
 (0)