mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Merge branch 'master' of github.com:jquery/jquery-ui into selectmenu
This commit is contained in:
commit
21d96f12f8
@ -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 );
|
||||
|
@ -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
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -261,6 +261,21 @@ test( "._getCreateOptions()", function() {
|
||||
$( "<div>" ).testWidget({ option2: "value2" });
|
||||
});
|
||||
|
||||
test( "._getCreateEventData()", function() {
|
||||
expect( 1 );
|
||||
var data = { foo: "bar" };
|
||||
$.widget( "ui.testWidget", {
|
||||
_getCreateEventData: function() {
|
||||
return data;
|
||||
}
|
||||
});
|
||||
$( "<div>" ).testWidget({
|
||||
create: function( event, ui ) {
|
||||
strictEqual( ui, data, "event data" );
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test( "re-init", function() {
|
||||
var div = $( "<div>" ),
|
||||
actions = [];
|
||||
|
14
ui/i18n/jquery.ui.datepicker-ko.js
vendored
14
ui/i18n/jquery.ui.datepicker-ko.js
vendored
@ -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']);
|
||||
});
|
2
ui/i18n/jquery.ui.datepicker-mk.js
vendored
2
ui/i18n/jquery.ui.datepicker-mk.js
vendored
@ -14,7 +14,7 @@ jQuery(function($){
|
||||
dayNamesShort: ['Нед','Пон','Вто','Сре','Чет','Пет','Саб'],
|
||||
dayNamesMin: ['Не','По','Вт','Ср','Че','Пе','Са'],
|
||||
weekHeader: 'Сед',
|
||||
dateFormat: 'dd/mm/yy',
|
||||
dateFormat: 'dd.mm.yy',
|
||||
firstDay: 1,
|
||||
isRTL: false,
|
||||
showMonthAfterYear: false,
|
||||
|
2
ui/i18n/jquery.ui.datepicker-nl-BE.js
vendored
2
ui/i18n/jquery.ui.datepicker-nl-BE.js
vendored
@ -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'] = {
|
||||
|
8
ui/jquery.ui.button.js
vendored
8
ui/jquery.ui.button.js
vendored
@ -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" )
|
||||
|
5
ui/jquery.ui.core.js
vendored
5
ui/jquery.ui.core.js
vendored
@ -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",
|
||||
|
5
ui/jquery.ui.datepicker.js
vendored
5
ui/jquery.ui.datepicker.js
vendored
@ -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;
|
||||
});
|
||||
|
2
ui/jquery.ui.position.js
vendored
2
ui/jquery.ui.position.js
vendored
@ -429,7 +429,7 @@ $.ui.position = {
|
||||
background: "none"
|
||||
};
|
||||
if ( body ) {
|
||||
jQuery.extend( testElementStyle, {
|
||||
$.extend( testElementStyle, {
|
||||
position: "absolute",
|
||||
left: "-1000px",
|
||||
top: "-1000px"
|
||||
|
6
ui/jquery.ui.sortable.js
vendored
6
ui/jquery.ui.sortable.js
vendored
@ -17,6 +17,7 @@
|
||||
$.widget("ui.sortable", $.ui.mouse, {
|
||||
version: "@VERSION",
|
||||
widgetEventPrefix: "sort",
|
||||
ready: false,
|
||||
options: {
|
||||
appendTo: "parent",
|
||||
axis: false,
|
||||
@ -59,6 +60,9 @@ $.widget("ui.sortable", $.ui.mouse, {
|
||||
//Initialize mouse events for interaction
|
||||
this._mouseInit();
|
||||
|
||||
//We're ready to go
|
||||
this.ready = true
|
||||
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
@ -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--){
|
||||
|
37
ui/jquery.ui.tabs.js
vendored
37
ui/jquery.ui.tabs.js
vendored
@ -13,23 +13,20 @@
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
var tabId = 0;
|
||||
var tabId = 0,
|
||||
rhash = /#.*$/;
|
||||
|
||||
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 ) {
|
||||
// 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",
|
||||
@ -123,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
|
||||
@ -212,7 +216,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 ];
|
||||
@ -244,6 +248,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 $( "<div></div>" )
|
||||
.attr( "id", id )
|
||||
|
3
ui/jquery.ui.widget.js
vendored
3
ui/jquery.ui.widget.js
vendored
@ -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,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user