aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2012-11-10 01:40:05 +0100
committerFelix Nagel <info@felixnagel.com>2012-11-10 01:40:05 +0100
commit7ce8e0515ea7cc513c3c065946c85cf2d1aa5652 (patch)
treea0337f9f7d8d0d27a7cdb78a63ee152d8357b32f /ui
parent94b3a65c66e338fc6f697d13fc77d7f19b8666ae (diff)
parentd6c6b7dc3381432f50212b4f458931b2521ecb56 (diff)
downloadjquery-ui-7ce8e0515ea7cc513c3c065946c85cf2d1aa5652.tar.gz
jquery-ui-7ce8e0515ea7cc513c3c065946c85cf2d1aa5652.zip
Merge branch 'master' into selectmenu
Diffstat (limited to 'ui')
-rw-r--r--ui/.jshintrc2
-rw-r--r--ui/i18n/jquery.ui.datepicker-ar.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-az.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-bs.js10
-rw-r--r--ui/i18n/jquery.ui.datepicker-cy-GB.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-el.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-es.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-et.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-eu.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-fa.js6
-rw-r--r--ui/i18n/jquery.ui.datepicker-fr-CH.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-gl.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-hr.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-hy.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-id.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-is.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-ja.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-ko.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-ky.js24
-rw-r--r--ui/i18n/jquery.ui.datepicker-lt.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-lv.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-ml.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-ms.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-nl.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-pt-BR.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-pt.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-ru.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-th.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-tj.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-tr.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-uk.js2
-rw-r--r--ui/jquery.ui.accordion.js213
-rw-r--r--ui/jquery.ui.autocomplete.js21
-rw-r--r--ui/jquery.ui.button.js4
-rw-r--r--ui/jquery.ui.core.js142
-rw-r--r--ui/jquery.ui.datepicker.js274
-rw-r--r--ui/jquery.ui.dialog.js349
-rw-r--r--ui/jquery.ui.draggable.js111
-rw-r--r--ui/jquery.ui.droppable.js54
-rw-r--r--ui/jquery.ui.effect-highlight.js2
-rw-r--r--ui/jquery.ui.effect-scale.js30
-rw-r--r--ui/jquery.ui.effect.js78
-rw-r--r--ui/jquery.ui.menu.js47
-rw-r--r--ui/jquery.ui.mouse.js16
-rw-r--r--ui/jquery.ui.position.js40
-rw-r--r--ui/jquery.ui.progressbar.js83
-rw-r--r--ui/jquery.ui.resizable.js182
-rw-r--r--ui/jquery.ui.selectable.js54
-rw-r--r--ui/jquery.ui.slider.js15
-rw-r--r--ui/jquery.ui.sortable.js63
-rw-r--r--ui/jquery.ui.spinner.js5
-rw-r--r--ui/jquery.ui.tabs.js540
-rw-r--r--ui/jquery.ui.tooltip.js118
-rw-r--r--ui/jquery.ui.widget.js66
54 files changed, 894 insertions, 1709 deletions
diff --git a/ui/.jshintrc b/ui/.jshintrc
index 415d69e90..edf09721b 100644
--- a/ui/.jshintrc
+++ b/ui/.jshintrc
@@ -8,9 +8,9 @@
"latedef": true,
"noarg": true,
"onevar": true,
- "smarttabs": true,
"trailing": true,
"undef": true,
+ "unused": true,
"predef": [
"Globalize"
]
diff --git a/ui/i18n/jquery.ui.datepicker-ar.js b/ui/i18n/jquery.ui.datepicker-ar.js
index f0d009667..cef0f08fd 100644
--- a/ui/i18n/jquery.ui.datepicker-ar.js
+++ b/ui/i18n/jquery.ui.datepicker-ar.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['ar']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-az.js b/ui/i18n/jquery.ui.datepicker-az.js
index 1101c8b91..a133a9eb2 100644
--- a/ui/i18n/jquery.ui.datepicker-az.js
+++ b/ui/i18n/jquery.ui.datepicker-az.js
@@ -20,4 +20,4 @@ jQuery(function($) {
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['az']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-bs.js b/ui/i18n/jquery.ui.datepicker-bs.js
index d64573755..f08870ffe 100644
--- a/ui/i18n/jquery.ui.datepicker-bs.js
+++ b/ui/i18n/jquery.ui.datepicker-bs.js
@@ -2,10 +2,10 @@
/* Written by Kenan Konjo. */
jQuery(function($){
$.datepicker.regional['bs'] = {
- closeText: 'Zatvori',
- prevText: '&#x3C;',
- nextText: '&#x3E;',
- currentText: 'Danas',
+ closeText: 'Zatvori',
+ prevText: '&#x3C;',
+ nextText: '&#x3E;',
+ currentText: 'Danas',
monthNames: ['Januar','Februar','Mart','April','Maj','Juni',
'Juli','August','Septembar','Oktobar','Novembar','Decembar'],
monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['bs']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-cy-GB.js b/ui/i18n/jquery.ui.datepicker-cy-GB.js
index dfee2f9d4..cf3a38e6c 100644
--- a/ui/i18n/jquery.ui.datepicker-cy-GB.js
+++ b/ui/i18n/jquery.ui.datepicker-cy-GB.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['cy-GB']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-el.js b/ui/i18n/jquery.ui.datepicker-el.js
index 6d775f995..1ac47561a 100644
--- a/ui/i18n/jquery.ui.datepicker-el.js
+++ b/ui/i18n/jquery.ui.datepicker-el.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['el']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-es.js b/ui/i18n/jquery.ui.datepicker-es.js
index 63368aecc..97a2d6ead 100644
--- a/ui/i18n/jquery.ui.datepicker-es.js
+++ b/ui/i18n/jquery.ui.datepicker-es.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['es']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-et.js b/ui/i18n/jquery.ui.datepicker-et.js
index 32702b243..62cbea8fa 100644
--- a/ui/i18n/jquery.ui.datepicker-et.js
+++ b/ui/i18n/jquery.ui.datepicker-et.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['et']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-eu.js b/ui/i18n/jquery.ui.datepicker-eu.js
index 846ce3abc..a71db2c72 100644
--- a/ui/i18n/jquery.ui.datepicker-eu.js
+++ b/ui/i18n/jquery.ui.datepicker-eu.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['eu']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-fa.js b/ui/i18n/jquery.ui.datepicker-fa.js
index be8acd2a5..bb957f6d8 100644
--- a/ui/i18n/jquery.ui.datepicker-fa.js
+++ b/ui/i18n/jquery.ui.datepicker-fa.js
@@ -37,7 +37,7 @@ jQuery(function($) {
'س',
'چ',
'پ',
- 'ج',
+ 'ج',
'ش'
],
dayNamesMin: [
@@ -46,7 +46,7 @@ jQuery(function($) {
'س',
'چ',
'پ',
- 'ج',
+ 'ج',
'ش'
],
weekHeader: 'هف',
@@ -56,4 +56,4 @@ jQuery(function($) {
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['fa']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-fr-CH.js b/ui/i18n/jquery.ui.datepicker-fr-CH.js
index fec03a042..e574537b0 100644
--- a/ui/i18n/jquery.ui.datepicker-fr-CH.js
+++ b/ui/i18n/jquery.ui.datepicker-fr-CH.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['fr-CH']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-gl.js b/ui/i18n/jquery.ui.datepicker-gl.js
index 0de64968f..59b989a6d 100644
--- a/ui/i18n/jquery.ui.datepicker-gl.js
+++ b/ui/i18n/jquery.ui.datepicker-gl.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['gl']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-hr.js b/ui/i18n/jquery.ui.datepicker-hr.js
index 6bc5aade1..2fe37b64b 100644
--- a/ui/i18n/jquery.ui.datepicker-hr.js
+++ b/ui/i18n/jquery.ui.datepicker-hr.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['hr']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-hy.js b/ui/i18n/jquery.ui.datepicker-hy.js
index b42851596..6d4eca555 100644
--- a/ui/i18n/jquery.ui.datepicker-hy.js
+++ b/ui/i18n/jquery.ui.datepicker-hy.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['hy']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-id.js b/ui/i18n/jquery.ui.datepicker-id.js
index 4ad46f640..6327fa60c 100644
--- a/ui/i18n/jquery.ui.datepicker-id.js
+++ b/ui/i18n/jquery.ui.datepicker-id.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['id']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-is.js b/ui/i18n/jquery.ui.datepicker-is.js
index f1b067ebf..925341a7a 100644
--- a/ui/i18n/jquery.ui.datepicker-is.js
+++ b/ui/i18n/jquery.ui.datepicker-is.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['is']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-ja.js b/ui/i18n/jquery.ui.datepicker-ja.js
index afd298315..4d0b63c77 100644
--- a/ui/i18n/jquery.ui.datepicker-ja.js
+++ b/ui/i18n/jquery.ui.datepicker-ja.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: true,
yearSuffix: '年'};
$.datepicker.setDefaults($.datepicker.regional['ja']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-ko.js b/ui/i18n/jquery.ui.datepicker-ko.js
index 04112424d..af36f3d6b 100644
--- a/ui/i18n/jquery.ui.datepicker-ko.js
+++ b/ui/i18n/jquery.ui.datepicker-ko.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: true,
yearSuffix: '년'};
$.datepicker.setDefaults($.datepicker.regional['ko']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-ky.js b/ui/i18n/jquery.ui.datepicker-ky.js
new file mode 100644
index 000000000..d4466b12e
--- /dev/null
+++ b/ui/i18n/jquery.ui.datepicker-ky.js
@@ -0,0 +1,24 @@
+/* Kyrgyz (UTF-8) initialisation for the jQuery UI date picker plugin. */
+/* Written by Sergey Kartashov (ebishkek@yandex.ru). */
+jQuery(function($){
+ $.datepicker.regional['ky'] = {
+ closeText: 'Жабуу',
+ prevText: '&#x3c;Мур',
+ nextText: 'Кий&#x3e;',
+ currentText: 'Бүгүн',
+ monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
+ 'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
+ monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
+ 'Июл','Авг','Сен','Окт','Ноя','Дек'],
+ dayNames: ['жекшемби', 'дүйшөмбү', 'шейшемби', 'шаршемби', 'бейшемби', 'жума', 'ишемби'],
+ dayNamesShort: ['жек', 'дүй', 'шей', 'шар', 'бей', 'жум', 'ише'],
+ dayNamesMin: ['Жк','Дш','Шш','Шр','Бш','Жм','Иш'],
+ weekHeader: 'Жум',
+ dateFormat: 'dd.mm.yy',
+ firstDay: 1,
+ isRTL: false,
+ showMonthAfterYear: false,
+ yearSuffix: ''
+ };
+ $.datepicker.setDefaults($.datepicker.regional['ky']);
+});
diff --git a/ui/i18n/jquery.ui.datepicker-lt.js b/ui/i18n/jquery.ui.datepicker-lt.js
index 2970f8f37..1afaaac5d 100644
--- a/ui/i18n/jquery.ui.datepicker-lt.js
+++ b/ui/i18n/jquery.ui.datepicker-lt.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['lt']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-lv.js b/ui/i18n/jquery.ui.datepicker-lv.js
index 003934e72..28cc102fc 100644
--- a/ui/i18n/jquery.ui.datepicker-lv.js
+++ b/ui/i18n/jquery.ui.datepicker-lv.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['lv']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-ml.js b/ui/i18n/jquery.ui.datepicker-ml.js
index 1e3432c0a..9b8f460db 100644
--- a/ui/i18n/jquery.ui.datepicker-ml.js
+++ b/ui/i18n/jquery.ui.datepicker-ml.js
@@ -3,7 +3,7 @@
jQuery(function($){
$.datepicker.regional['ml'] = {
closeText: 'ശരി',
- prevText: 'മുന്നത്തെ',
+ prevText: 'മുന്നത്തെ',
nextText: 'അടുത്തത് ',
currentText: 'ഇന്ന്',
monthNames: ['ജനുവരി','ഫെബ്രുവരി','മാര്‍ച്ച്','ഏപ്രില്‍','മേയ്','ജൂണ്‍',
diff --git a/ui/i18n/jquery.ui.datepicker-ms.js b/ui/i18n/jquery.ui.datepicker-ms.js
index c290af10a..e70de7299 100644
--- a/ui/i18n/jquery.ui.datepicker-ms.js
+++ b/ui/i18n/jquery.ui.datepicker-ms.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['ms']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-nl.js b/ui/i18n/jquery.ui.datepicker-nl.js
index 781fe6191..203f16069 100644
--- a/ui/i18n/jquery.ui.datepicker-nl.js
+++ b/ui/i18n/jquery.ui.datepicker-nl.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional.nl);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-pt-BR.js b/ui/i18n/jquery.ui.datepicker-pt-BR.js
index 0741892ab..521967ec3 100644
--- a/ui/i18n/jquery.ui.datepicker-pt-BR.js
+++ b/ui/i18n/jquery.ui.datepicker-pt-BR.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['pt-BR']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-pt.js b/ui/i18n/jquery.ui.datepicker-pt.js
index 98925b455..999f20e3e 100644
--- a/ui/i18n/jquery.ui.datepicker-pt.js
+++ b/ui/i18n/jquery.ui.datepicker-pt.js
@@ -19,4 +19,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['pt']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-ru.js b/ui/i18n/jquery.ui.datepicker-ru.js
index 2017e0537..a51971405 100644
--- a/ui/i18n/jquery.ui.datepicker-ru.js
+++ b/ui/i18n/jquery.ui.datepicker-ru.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['ru']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-th.js b/ui/i18n/jquery.ui.datepicker-th.js
index d57541f64..aecfd27cc 100644
--- a/ui/i18n/jquery.ui.datepicker-th.js
+++ b/ui/i18n/jquery.ui.datepicker-th.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['th']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-tj.js b/ui/i18n/jquery.ui.datepicker-tj.js
index ed662392c..9a20e4d37 100644
--- a/ui/i18n/jquery.ui.datepicker-tj.js
+++ b/ui/i18n/jquery.ui.datepicker-tj.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['tj']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-tr.js b/ui/i18n/jquery.ui.datepicker-tr.js
index 1b5cafc39..75b583a77 100644
--- a/ui/i18n/jquery.ui.datepicker-tr.js
+++ b/ui/i18n/jquery.ui.datepicker-tr.js
@@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['tr']);
-}); \ No newline at end of file
+});
diff --git a/ui/i18n/jquery.ui.datepicker-uk.js b/ui/i18n/jquery.ui.datepicker-uk.js
index 31964af44..2bdc82ff7 100644
--- a/ui/i18n/jquery.ui.datepicker-uk.js
+++ b/ui/i18n/jquery.ui.datepicker-uk.js
@@ -21,4 +21,4 @@ jQuery(function($){
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['uk']);
-}); \ No newline at end of file
+});
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js
index 48e880a05..17ce155a8 100644
--- a/ui/jquery.ui.accordion.js
+++ b/ui/jquery.ui.accordion.js
@@ -59,8 +59,8 @@ $.widget( "ui.accordion", {
.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
.hide();
- // don't allow collapsible: false and active: false
- if ( !options.collapsible && options.active === false ) {
+ // don't allow collapsible: false and active: false / null
+ if ( !options.collapsible && (options.active === false || options.active == null) ) {
options.active = 0;
}
// handle negative values
@@ -75,7 +75,6 @@ $.widget( "ui.accordion", {
.show();
this._createIcons();
- this.originalHeight = this.element[0].style.height;
this.refresh();
// ARIA
@@ -198,7 +197,6 @@ $.widget( "ui.accordion", {
}
});
if ( this.options.heightStyle !== "content" ) {
- this.element.css( "height", this.originalHeight );
contents.css( "height", "" );
}
},
@@ -285,21 +283,11 @@ $.widget( "ui.accordion", {
},
refresh: function() {
- var maxHeight, overflow,
+ var maxHeight,
heightStyle = this.options.heightStyle,
parent = this.element.parent();
- this.element.css( "height", this.originalHeight );
-
if ( heightStyle === "fill" ) {
- // IE 6 treats height like minHeight, so we need to turn off overflow
- // in order to get a reliable height
- // we use the minHeight support test because we assume that only
- // browsers that don't support minHeight will treat height as minHeight
- if ( !$.support.minHeight ) {
- overflow = parent.css( "overflow" );
- parent.css( "overflow", "hidden");
- }
maxHeight = parent.height();
this.element.siblings( ":visible" ).each(function() {
var elem = $( this ),
@@ -310,9 +298,6 @@ $.widget( "ui.accordion", {
}
maxHeight -= elem.outerHeight( true );
});
- if ( overflow ) {
- parent.css( "overflow", overflow );
- }
this.headers.each(function() {
maxHeight -= $( this ).outerHeight( true );
@@ -332,10 +317,6 @@ $.widget( "ui.accordion", {
})
.height( maxHeight );
}
-
- if ( heightStyle !== "content" ) {
- this.element.height( this.element.height() );
- }
},
_activate: function( index ) {
@@ -547,192 +528,4 @@ $.widget( "ui.accordion", {
}
});
-
-
-// DEPRECATED
-if ( $.uiBackCompat !== false ) {
- // navigation options
- (function( $, prototype ) {
- $.extend( prototype.options, {
- navigation: false,
- navigationFilter: function() {
- return this.href.toLowerCase() === location.href.toLowerCase();
- }
- });
-
- var _create = prototype._create;
- prototype._create = function() {
- if ( this.options.navigation ) {
- var that = this,
- headers = this.element.find( this.options.header ),
- content = headers.next(),
- current = headers.add( content )
- .find( "a" )
- .filter( this.options.navigationFilter )
- [ 0 ];
- if ( current ) {
- headers.add( content ).each( function( index ) {
- if ( $.contains( this, current ) ) {
- that.options.active = Math.floor( index / 2 );
- return false;
- }
- });
- }
- }
- _create.call( this );
- };
- }( jQuery, jQuery.ui.accordion.prototype ) );
-
- // height options
- (function( $, prototype ) {
- $.extend( prototype.options, {
- heightStyle: null, // remove default so we fall back to old values
- autoHeight: true, // use heightStyle: "auto"
- clearStyle: false, // use heightStyle: "content"
- fillSpace: false // use heightStyle: "fill"
- });
-
- var _create = prototype._create,
- _setOption = prototype._setOption;
-
- $.extend( prototype, {
- _create: function() {
- this.options.heightStyle = this.options.heightStyle ||
- this._mergeHeightStyle();
-
- _create.call( this );
- },
-
- _setOption: function( key, value ) {
- if ( key === "autoHeight" || key === "clearStyle" || key === "fillSpace" ) {
- this.options.heightStyle = this._mergeHeightStyle();
- }
- _setOption.apply( this, arguments );
- },
-
- _mergeHeightStyle: function() {
- var options = this.options;
-
- if ( options.fillSpace ) {
- return "fill";
- }
-
- if ( options.clearStyle ) {
- return "content";
- }
-
- if ( options.autoHeight ) {
- return "auto";
- }
- }
- });
- }( jQuery, jQuery.ui.accordion.prototype ) );
-
- // icon options
- (function( $, prototype ) {
- $.extend( prototype.options.icons, {
- activeHeader: null, // remove default so we fall back to old values
- headerSelected: "ui-icon-triangle-1-s"
- });
-
- var _createIcons = prototype._createIcons;
- prototype._createIcons = function() {
- if ( this.options.icons ) {
- this.options.icons.activeHeader = this.options.icons.activeHeader ||
- this.options.icons.headerSelected;
- }
- _createIcons.call( this );
- };
- }( jQuery, jQuery.ui.accordion.prototype ) );
-
- // expanded active option, activate method
- (function( $, prototype ) {
- prototype.activate = prototype._activate;
-
- var _findActive = prototype._findActive;
- prototype._findActive = function( index ) {
- if ( index === -1 ) {
- index = false;
- }
- if ( index && typeof index !== "number" ) {
- index = this.headers.index( this.headers.filter( index ) );
- if ( index === -1 ) {
- index = false;
- }
- }
- return _findActive.call( this, index );
- };
- }( jQuery, jQuery.ui.accordion.prototype ) );
-
- // resize method
- jQuery.ui.accordion.prototype.resize = jQuery.ui.accordion.prototype.refresh;
-
- // change events
- (function( $, prototype ) {
- $.extend( prototype.options, {
- change: null,
- changestart: null
- });
-
- var _trigger = prototype._trigger;
- prototype._trigger = function( type, event, data ) {
- var ret = _trigger.apply( this, arguments );
- if ( !ret ) {
- return false;
- }
-
- if ( type === "beforeActivate" ) {
- ret = _trigger.call( this, "changestart", event, {
- oldHeader: data.oldHeader,
- oldContent: data.oldPanel,
- newHeader: data.newHeader,
- newContent: data.newPanel
- });
- } else if ( type === "activate" ) {
- ret = _trigger.call( this, "change", event, {
- oldHeader: data.oldHeader,
- oldContent: data.oldPanel,
- newHeader: data.newHeader,
- newContent: data.newPanel
- });
- }
- return ret;
- };
- }( jQuery, jQuery.ui.accordion.prototype ) );
-
- // animated option
- // NOTE: this only provides support for "slide", "bounceslide", and easings
- // not the full $.ui.accordion.animations API
- (function( $, prototype ) {
- $.extend( prototype.options, {
- animate: null,
- animated: "slide"
- });
-
- var _create = prototype._create;
- prototype._create = function() {
- var options = this.options;
- if ( options.animate === null ) {
- if ( !options.animated ) {
- options.animate = false;
- } else if ( options.animated === "slide" ) {
- options.animate = 300;
- } else if ( options.animated === "bounceslide" ) {
- options.animate = {
- duration: 200,
- down: {
- easing: "easeOutBounce",
- duration: 1000
- }
- };
- } else {
- options.animate = options.animated;
- }
- }
-
- _create.call( this );
- };
- }( jQuery, jQuery.ui.accordion.prototype ) );
-}
-
})( jQuery );
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index f181e9180..f5ab57bd4 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -64,7 +64,7 @@ $.widget( "ui.autocomplete", {
.addClass( "ui-autocomplete-input" )
.attr( "autocomplete", "off" );
- this._on({
+ this._on( this.element, {
keydown: function( event ) {
if ( this.element.prop( "readOnly" ) ) {
suppressKeyPress = true;
@@ -190,7 +190,8 @@ $.widget( "ui.autocomplete", {
})
.zIndex( this.element.zIndex() + 1 )
.hide()
- .data( "menu" );
+ .data( "ui-menu" );
+
this._on( this.menu.element, {
mousedown: function( event ) {
// prevent moving focus out of the text field
@@ -236,9 +237,7 @@ $.widget( "ui.autocomplete", {
}
}
- // back compat for _renderItem using item.autocomplete, via #7810
- // TODO remove the fallback, see #8156
- var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" );
+ var item = ui.item.data( "ui-autocomplete-item" );
if ( false !== this._trigger( "focus", event, { item: item } ) ) {
// use value to match what will end up in the input, if it was a key event
if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
@@ -254,9 +253,7 @@ $.widget( "ui.autocomplete", {
}
},
menuselect: function( event, ui ) {
- // back compat for _renderItem using item.autocomplete, via #7810
- // TODO remove the fallback, see #8156
- var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ),
+ var item = ui.item.data( "ui-autocomplete-item" ),
previous = this.previous;
// only trigger when focus was lost (click on menu)
@@ -291,10 +288,6 @@ $.widget( "ui.autocomplete", {
.addClass( "ui-helper-hidden-accessible" )
.insertAfter( this.element );
- if ( $.fn.bgiframe ) {
- this.menu.element.bgiframe();
- }
-
// turning off autocomplete prevents the browser from remembering the
// value when navigating through history, so we re-enable autocomplete
// if the page is unloaded before the widget is destroyed. #7790
@@ -359,7 +352,7 @@ $.widget( "ui.autocomplete", {
url: url,
data: request,
dataType: "json",
- success: function( data, status ) {
+ success: function( data ) {
response( data );
},
error: function() {
@@ -541,7 +534,7 @@ $.widget( "ui.autocomplete", {
return this.menu.element;
},
- _value: function( value ) {
+ _value: function() {
return this.valueMethod.apply( this.element, arguments );
},
diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js
index 5ae526488..6d7b94a38 100644
--- a/ui/jquery.ui.button.js
+++ b/ui/jquery.ui.button.js
@@ -282,7 +282,7 @@ $.widget( "ui.button", {
},
refresh: function() {
- var isDisabled = this.element.is( ":disabled" );
+ var isDisabled = this.element.is( ":disabled" ) || this.element.hasClass( "ui-button-disabled" );
if ( isDisabled !== this.options.disabled ) {
this._setOption( "disabled", isDisabled );
}
@@ -358,7 +358,7 @@ $.widget( "ui.button", {
$.widget( "ui.buttonset", {
version: "@VERSION",
options: {
- items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(button)"
+ items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
},
_create: function() {
diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js
index e569eea42..288634376 100644
--- a/ui/jquery.ui.core.js
+++ b/ui/jquery.ui.core.js
@@ -128,53 +128,6 @@ $.fn.extend({
}
});
-// support: jQuery <1.8
-if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
- $.each( [ "Width", "Height" ], function( i, name ) {
- var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
- type = name.toLowerCase(),
- orig = {
- innerWidth: $.fn.innerWidth,
- innerHeight: $.fn.innerHeight,
- outerWidth: $.fn.outerWidth,
- outerHeight: $.fn.outerHeight
- };
-
- function reduce( elem, size, border, margin ) {
- $.each( side, function() {
- size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
- if ( border ) {
- size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
- }
- if ( margin ) {
- size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
- }
- });
- return size;
- }
-
- $.fn[ "inner" + name ] = function( size ) {
- if ( size === undefined ) {
- return orig[ "inner" + name ].call( this );
- }
-
- return this.each(function() {
- $( this ).css( type, reduce( this, size ) + "px" );
- });
- };
-
- $.fn[ "outer" + name] = function( size, margin ) {
- if ( typeof size !== "number" ) {
- return orig[ "outer" + name ].call( this, size );
- }
-
- return this.each(function() {
- $( this).css( type, reduce( this, size, true, margin ) + "px" );
- });
- };
- });
-}
-
// selectors
function focusable( element, isTabIndexNotNaN ) {
var map, mapName, img,
@@ -198,10 +151,10 @@ function focusable( element, isTabIndexNotNaN ) {
}
function visible( element ) {
- return !$( element ).parents().andSelf().filter(function() {
- return $.css( this, "visibility" ) === "hidden" ||
- $.expr.filters.hidden( this );
- }).length;
+ return $.expr.filters.visible( element ) &&
+ !$( element ).parents().andSelf().filter(function() {
+ return $.css( this, "visibility" ) === "hidden";
+ }).length;
}
$.extend( $.expr[ ":" ], {
@@ -228,41 +181,74 @@ $.extend( $.expr[ ":" ], {
});
// support
-$(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 element to continue to take up space even
- // after it is removed from the DOM (#8026)
- div.offsetHeight;
-
- $.extend( div.style, {
- minHeight: "100px",
- height: "auto",
- padding: 0,
- borderWidth: 0
- });
+$.support.selectstart = "onselectstart" in document.createElement( "div" );
- $.support.minHeight = div.offsetHeight === 100;
- $.support.selectstart = "onselectstart" in div;
+// support: jQuery <1.8
+if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
+ $.each( [ "Width", "Height" ], function( i, name ) {
+ var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
+ type = name.toLowerCase(),
+ orig = {
+ innerWidth: $.fn.innerWidth,
+ innerHeight: $.fn.innerHeight,
+ outerWidth: $.fn.outerWidth,
+ outerHeight: $.fn.outerHeight
+ };
- // set display to none to avoid a layout bug in IE
- // http://dev.jquery.com/ticket/4014
- body.removeChild( div ).style.display = "none";
-});
+ function reduce( elem, size, border, margin ) {
+ $.each( side, function() {
+ size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
+ if ( border ) {
+ size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
+ }
+ if ( margin ) {
+ size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
+ }
+ });
+ return size;
+ }
+ $.fn[ "inner" + name ] = function( size ) {
+ if ( size === undefined ) {
+ return orig[ "inner" + name ].call( this );
+ }
+
+ return this.each(function() {
+ $( this ).css( type, reduce( this, size ) + "px" );
+ });
+ };
+
+ $.fn[ "outer" + name] = function( size, margin ) {
+ if ( typeof size !== "number" ) {
+ return orig[ "outer" + name ].call( this, size );
+ }
+
+ return this.each(function() {
+ $( this).css( type, reduce( this, size, true, margin ) + "px" );
+ });
+ };
+ });
+}
+
+// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
+if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
+ $.fn.removeData = (function( removeData ) {
+ return function( key ) {
+ if ( arguments.length ) {
+ return removeData.call( this, $.camelCase( key ) );
+ } else {
+ return removeData.call( this );
+ }
+ };
+ })( $.fn.removeData );
+}
-// deprecated
-(function() {
- var uaMatch = /msie ([\w.]+)/.exec( navigator.userAgent.toLowerCase() ) || [];
- $.ui.ie = uaMatch.length ? true : false;
- $.ui.ie6 = parseFloat( uaMatch[ 1 ], 10 ) === 6;
-})();
+// deprecated
+$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
$.fn.extend({
disableSelection: function() {
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index 4643af2eb..c7ecafffb 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -13,6 +13,7 @@
*/
(function( $, undefined ) {
+/*jshint onevar: false, curly: false, eqeqeq: false, shadow: true, devel: true, evil: true */
$.extend($.ui, { datepicker: { version: "@VERSION" } });
var PROP_NAME = 'datepicker';
@@ -116,7 +117,7 @@ function Datepicker() {
$.extend(Datepicker.prototype, {
/* Class name added to elements to indicate already configured with a date picker. */
markerClassName: 'hasDatepicker',
-
+
//Keep track of the maximum number of rows displayed (see #7043)
maxRows: 4,
@@ -125,23 +126,25 @@ $.extend(Datepicker.prototype, {
if (this.debug)
console.log.apply('', arguments);
},
-
+
// TODO rename to "widget" when switching to widget factory
_widgetDatepicker: function() {
return this.dpDiv;
},
/* Override the default settings for all instances of the date picker.
- @param settings object - the new settings to use as defaults (anonymous object)
- @return the manager object */
+ * @param settings object - the new settings to use as defaults (anonymous object)
+ * @return the manager object
+ */
setDefaults: function(settings) {
extendRemove(this._defaults, settings || {});
return this;
},
/* Attach the date picker to a jQuery selection.
- @param target element - the target input field or division or span
- @param settings object - the new settings to use for this date picker instance (anonymous) */
+ * @param target element - the target input field or division or span
+ * @param settings object - the new settings to use for this date picker instance (anonymous)
+ */
_attachDatepicker: function(target, settings) {
// check for settings on the control itself - in namespace 'date:'
var inlineSettings = null;
@@ -173,7 +176,7 @@ $.extend(Datepicker.prototype, {
/* Create a new instance object. */
_newInst: function(target, inline) {
- var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
+ var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, '\\\\$1'); // escape jQuery meta chars
return {id: id, input: target, // associated target
selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
drawMonth: 0, drawYear: 0, // month being drawn
@@ -228,14 +231,14 @@ $.extend(Datepicker.prototype, {
$('<img/>').addClass(this._triggerClass).
attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
$('<button type="button"></button>').addClass(this._triggerClass).
- html(buttonImage == '' ? buttonText : $('<img/>').attr(
+ html(!buttonImage ? buttonText : $('<img/>').attr(
{ src:buttonImage, alt:buttonText, title:buttonText })));
input[isRTL ? 'before' : 'after'](inst.trigger);
inst.trigger.click(function() {
if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
$.datepicker._hideDatepicker();
else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) {
- $.datepicker._hideDatepicker();
+ $.datepicker._hideDatepicker();
$.datepicker._showDatepicker(input[0]);
} else
$.datepicker._showDatepicker(input[0]);
@@ -295,14 +298,15 @@ $.extend(Datepicker.prototype, {
},
/* Pop-up the date picker in a "dialog" box.
- @param input element - ignored
- @param date string or Date - the initial date to display
- @param onSelect function - the function to call when a date is selected
- @param settings object - update the dialog date picker instance's settings (anonymous object)
- @param pos int[2] - coordinates for the dialog's position within the screen or
- event - with x/y coordinates or
- leave empty for default (screen centre)
- @return the manager object */
+ * @param input element - ignored
+ * @param date string or Date - the initial date to display
+ * @param onSelect function - the function to call when a date is selected
+ * @param settings object - update the dialog date picker instance's settings (anonymous object)
+ * @param pos int[2] - coordinates for the dialog's position within the screen or
+ * event - with x/y coordinates or
+ * leave empty for default (screen centre)
+ * @return the manager object
+ */
_dialogDatepicker: function(input, date, onSelect, settings, pos) {
var inst = this._dialogInst; // internal instance
if (!inst) {
@@ -343,7 +347,8 @@ $.extend(Datepicker.prototype, {
},
/* Detach a datepicker from its control.
- @param target element - the target input field or division or span */
+ * @param target element - the target input field or division or span
+ */
_destroyDatepicker: function(target) {
var $target = $(target);
var inst = $.data(target, PROP_NAME);
@@ -365,7 +370,8 @@ $.extend(Datepicker.prototype, {
},
/* Enable the date picker to a jQuery selection.
- @param target element - the target input field or division or span */
+ * @param target element - the target input field or division or span
+ */
_enableDatepicker: function(target) {
var $target = $(target);
var inst = $.data(target, PROP_NAME);
@@ -390,7 +396,8 @@ $.extend(Datepicker.prototype, {
},
/* Disable the date picker to a jQuery selection.
- @param target element - the target input field or division or span */
+ * @param target element - the target input field or division or span
+ */
_disableDatepicker: function(target) {
var $target = $(target);
var inst = $.data(target, PROP_NAME);
@@ -416,8 +423,9 @@ $.extend(Datepicker.prototype, {
},
/* Is the first field in a jQuery collection disabled as a datepicker?
- @param target element - the target input field or division or span
- @return boolean - true if disabled, false if enabled */
+ * @param target element - the target input field or division or span
+ * @return boolean - true if disabled, false if enabled
+ */
_isDisabledDatepicker: function(target) {
if (!target) {
return false;
@@ -430,9 +438,10 @@ $.extend(Datepicker.prototype, {
},
/* Retrieve the instance data for the target control.
- @param target element - the target input field or division or span
- @return object - the associated instance data
- @throws error if a jQuery problem getting data */
+ * @param target element - the target input field or division or span
+ * @return object - the associated instance data
+ * @throws error if a jQuery problem getting data
+ */
_getInst: function(target) {
try {
return $.data(target, PROP_NAME);
@@ -443,13 +452,14 @@ $.extend(Datepicker.prototype, {
},
/* Update or retrieve the settings for a date picker attached to an input field or division.
- @param target element - the target input field or division or span
- @param name object - the new settings to update or
- string - the name of the setting to change or retrieve,
- when retrieving also 'all' for all instance settings or
- 'defaults' for all global defaults
- @param value any - the new value for the setting
- (omit if above is an object or to retrieve a value) */
+ * @param target element - the target input field or division or span
+ * @param name object - the new settings to update or
+ * string - the name of the setting to change or retrieve,
+ * when retrieving also 'all' for all instance settings or
+ * 'defaults' for all global defaults
+ * @param value any - the new value for the setting
+ * (omit if above is an object or to retrieve a value)
+ */
_optionDatepicker: function(target, name, value) {
var inst = this._getInst(target);
if (arguments.length == 2 && typeof name == 'string') {
@@ -471,9 +481,9 @@ $.extend(Datepicker.prototype, {
var maxDate = this._getMinMaxDate(inst, 'max');
extendRemove(inst.settings, settings);
// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
- if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined)
+ if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined)
inst.settings.minDate = this._formatDate(inst, minDate);
- if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined)
+ if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined)
inst.settings.maxDate = this._formatDate(inst, maxDate);
this._attachments($(target), inst);
this._autoSize(inst);
@@ -489,7 +499,8 @@ $.extend(Datepicker.prototype, {
},
/* Redraw the date picker attached to an input field or division.
- @param target element - the target input field or division or span */
+ * @param target element - the target input field or division or span
+ */
_refreshDatepicker: function(target) {
var inst = this._getInst(target);
if (inst) {
@@ -498,8 +509,9 @@ $.extend(Datepicker.prototype, {
},
/* Set the dates for a jQuery selection.
- @param target element - the target input field or division or span
- @param date Date - the new date */
+ * @param target element - the target input field or division or span
+ * @param date Date - the new date
+ */
_setDateDatepicker: function(target, date) {
var inst = this._getInst(target);
if (inst) {
@@ -510,9 +522,10 @@ $.extend(Datepicker.prototype, {
},
/* Get the date(s) for the first entry in a jQuery selection.
- @param target element - the target input field or division or span
- @param noDefault boolean - true if no default date is to be used
- @return Date - the current date */
+ * @param target element - the target input field or division or span
+ * @param noDefault boolean - true if no default date is to be used
+ * @return Date - the current date
+ */
_getDateDatepicker: function(target, noDefault) {
var inst = this._getInst(target);
if (inst && !inst.inline)
@@ -531,7 +544,7 @@ $.extend(Datepicker.prototype, {
case 9: $.datepicker._hideDatepicker();
handled = false;
break; // hide on tab out
- case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
+ case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
$.datepicker._currentClass + ')', inst.dpDiv);
if (sel[0])
$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
@@ -545,7 +558,6 @@ $.extend(Datepicker.prototype, {
else
$.datepicker._hideDatepicker();
return false; // don't submit the form
- break; // select the value on enter
case 27: $.datepicker._hideDatepicker();
break; // hide on escape
case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
@@ -602,7 +614,7 @@ $.extend(Datepicker.prototype, {
var inst = $.datepicker._getInst(event.target);
if ($.datepicker._get(inst, 'constrainInput')) {
var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
- var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
+ var chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode);
return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
}
},
@@ -629,9 +641,10 @@ $.extend(Datepicker.prototype, {
},
/* Pop-up the date picker for a given input field.
- If false returned from beforeShow event handler do not show.
- @param input element - the input field attached to the date picker or
- event - if triggered by focus */
+ * If false returned from beforeShow event handler do not show.
+ * @param input element - the input field attached to the date picker or
+ * event - if triggered by focus
+ */
_showDatepicker: function(input) {
input = input.target || input;
if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
@@ -682,24 +695,13 @@ $.extend(Datepicker.prototype, {
if (!inst.inline) {
var showAnim = $.datepicker._get(inst, 'showAnim');
var duration = $.datepicker._get(inst, 'duration');
- var postProcess = function() {
- var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
- if( !! cover.length ){
- var borders = $.datepicker._getBorders(inst.dpDiv);
- cover.css({left: -borders[0], top: -borders[1],
- width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
- }
- };
inst.dpDiv.zIndex($(input).zIndex()+1);
$.datepicker._datepickerShowing = true;
- // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
- if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) )
- inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
+ if ( $.effects && $.effects.effect[ showAnim ] )
+ inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration);
else
- inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
- if (!showAnim || !duration)
- postProcess();
+ inst.dpDiv[showAnim || 'show'](showAnim ? duration : null);
if (inst.input.is(':visible') && !inst.input.is(':disabled'))
inst.input.focus();
$.datepicker._curInst = inst;
@@ -709,14 +711,9 @@ $.extend(Datepicker.prototype, {
/* Generate the date picker content. */
_updateDatepicker: function(inst) {
this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
- var borders = $.datepicker._getBorders(inst.dpDiv);
instActive = inst; // for delegate hover events
inst.dpDiv.empty().append(this._generateHTML(inst));
this._attachHandlers(inst);
- var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
- if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6
- cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
- }
inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover();
var numMonths = this._getNumberOfMonths(inst);
var cols = numMonths[1];
@@ -733,7 +730,7 @@ $.extend(Datepicker.prototype, {
// this breaks the change event in IE
inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
inst.input.focus();
- // deffered render of the years select (to avoid flashes on Firefox)
+ // deffered render of the years select (to avoid flashes on Firefox)
if( inst.yearshtml ){
var origyearshtml = inst.yearshtml;
setTimeout(function(){
@@ -747,8 +744,9 @@ $.extend(Datepicker.prototype, {
},
/* Retrieve the size of left and top borders for an element.
- @param elem (jQuery object) the element of interest
- @return (number[2]) the left and top borders */
+ * @param elem (jQuery object) the element of interest
+ * @return (number[2]) the left and top borders
+ */
_getBorders: function(elem) {
var convert = function(value) {
return {thin: 1, medium: 2, thick: 3}[value] || value;
@@ -791,7 +789,8 @@ $.extend(Datepicker.prototype, {
},
/* Hide the date picker from view.
- @param input element - the input field attached to the date picker */
+ * @param input element - the input field attached to the date picker
+ */
_hideDatepicker: function(input) {
var inst = this._curInst;
if (!inst || (input && inst != $.data(input, PROP_NAME)))
@@ -842,7 +841,7 @@ $.extend(Datepicker.prototype, {
inst = $.datepicker._getInst($target[0]);
if ( ( ( $target[0].id != $.datepicker._mainDivId &&
- $target.parents('#' + $.datepicker._mainDivId).length == 0 &&
+ $target.parents('#' + $.datepicker._mainDivId).length === 0 &&
!$target.hasClass($.datepicker.markerClassName) &&
!$target.closest("." + $.datepicker._triggerClass).length &&
$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
@@ -910,7 +909,6 @@ $.extend(Datepicker.prototype, {
/* Erase the input field and hide the date picker. */
_clearDate: function(id) {
var target = $(id);
- var inst = this._getInst(target[0]);
this._selectDate(target, '');
},
@@ -950,16 +948,18 @@ $.extend(Datepicker.prototype, {
},
/* Set as beforeShowDay function to prevent selection of weekends.
- @param date Date - the date to customise
- @return [boolean, string] - is this date selectable?, what is its CSS class? */
+ * @param date Date - the date to customise
+ * @return [boolean, string] - is this date selectable?, what is its CSS class?
+ */
noWeekends: function(date) {
var day = date.getDay();
return [(day > 0 && day < 6), ''];
},
/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
- @param date Date - the date to get the week for
- @return number - the number of the week within the year that contains this date */
+ * @param date Date - the date to get the week for
+ * @return number - the number of the week within the year that contains this date
+ */
iso8601Week: function(date) {
var checkDate = new Date(date.getTime());
// Find Thursday of this week starting on Monday
@@ -971,22 +971,23 @@ $.extend(Datepicker.prototype, {
},
/* Parse a string value into a date object.
- See formatDate below for the possible formats.
-
- @param format string - the expected format of the date
- @param value string - the date in the above format
- @param settings Object - attributes include:
- shortYearCutoff number - the cutoff year for determining the century (optional)
- dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
- dayNames string[7] - names of the days from Sunday (optional)
- monthNamesShort string[12] - abbreviated names of the months (optional)
- monthNames string[12] - names of the months (optional)
- @return Date - the extracted date value or null if value is blank */
+ * See formatDate below for the possible formats.
+ *
+ * @param format string - the expected format of the date
+ * @param value string - the date in the above format
+ * @param settings Object - attributes include:
+ * shortYearCutoff number - the cutoff year for determining the century (optional)
+ * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
+ * dayNames string[7] - names of the days from Sunday (optional)
+ * monthNamesShort string[12] - abbreviated names of the months (optional)
+ * monthNames string[12] - names of the months (optional)
+ * @return Date - the extracted date value or null if value is blank
+ */
parseDate: function (format, value, settings) {
if (format == null || value == null)
throw 'Invalid arguments';
value = (typeof value == 'object' ? value.toString() : value + '');
- if (value == '')
+ if (value === '')
return null;
var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
@@ -1141,32 +1142,33 @@ $.extend(Datepicker.prototype, {
Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
/* Format a date object into a string value.
- The format can be combinations of the following:
- d - day of month (no leading zero)
- dd - day of month (two digit)
- o - day of year (no leading zeros)
- oo - day of year (three digit)
- D - day name short
- DD - day name long
- m - month of year (no leading zero)
- mm - month of year (two digit)
- M - month name short
- MM - month name long
- y - year (two digit)
- yy - year (four digit)
- @ - Unix timestamp (ms since 01/01/1970)
- ! - Windows ticks (100ns since 01/01/0001)
- '...' - literal text
- '' - single quote
-
- @param format string - the desired format of the date
- @param date Date - the date value to format
- @param settings Object - attributes include:
- dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
- dayNames string[7] - names of the days from Sunday (optional)
- monthNamesShort string[12] - abbreviated names of the months (optional)
- monthNames string[12] - names of the months (optional)
- @return string - the date in the above format */
+ * The format can be combinations of the following:
+ * d - day of month (no leading zero)
+ * dd - day of month (two digit)
+ * o - day of year (no leading zeros)
+ * oo - day of year (three digit)
+ * D - day name short
+ * DD - day name long
+ * m - month of year (no leading zero)
+ * mm - month of year (two digit)
+ * M - month name short
+ * MM - month name long
+ * y - year (two digit)
+ * yy - year (four digit)
+ * @ - Unix timestamp (ms since 01/01/1970)
+ * ! - Windows ticks (100ns since 01/01/0001)
+ * '...' - literal text
+ * '' - single quote
+ *
+ * @param format string - the desired format of the date
+ * @param date Date - the date value to format
+ * @param settings Object - attributes include:
+ * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
+ * dayNames string[7] - names of the days from Sunday (optional)
+ * monthNamesShort string[12] - abbreviated names of the months (optional)
+ * monthNames string[12] - names of the months (optional)
+ * @return string - the date in the above format
+ */
formatDate: function (format, date, settings) {
if (!date)
return '';
@@ -1336,7 +1338,7 @@ $.extend(Datepicker.prototype, {
var year = date.getFullYear();
var month = date.getMonth();
var day = date.getDate();
- var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
+ var pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
var matches = pattern.exec(offset);
while (matches) {
switch (matches[2] || 'd') {
@@ -1370,11 +1372,12 @@ $.extend(Datepicker.prototype, {
},
/* Handle switch to/from daylight saving.
- Hours may be non-zero on daylight saving cut-over:
- > 12 when midnight changeover, but then cannot generate
- midnight datetime, so jump to 1AM, otherwise reset.
- @param date (Date) the date to check
- @return (Date) the corrected date */
+ * Hours may be non-zero on daylight saving cut-over:
+ * > 12 when midnight changeover, but then cannot generate
+ * midnight datetime, so jump to 1AM, otherwise reset.
+ * @param date (Date) the date to check
+ * @return (Date) the corrected date
+ */
_daylightSavingAdjust: function(date) {
if (!date) return null;
date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
@@ -1400,7 +1403,7 @@ $.extend(Datepicker.prototype, {
/* Retrieve the date(s) directly. */
_getDate: function(inst) {
- var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
+ var startDate = (!inst.currentYear || (inst.input && inst.input.val() === '') ? null :
this._daylightSavingAdjust(new Date(
inst.currentYear, inst.currentMonth, inst.currentDay)));
return startDate;
@@ -1442,7 +1445,7 @@ $.extend(Datepicker.prototype, {
$(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]);
});
},
-
+
/* Generate the HTML for the current state of the date picker. */
_generateHTML: function(inst) {
var today = new Date();
@@ -1509,14 +1512,12 @@ $.extend(Datepicker.prototype, {
firstDay = (isNaN(firstDay) ? 0 : firstDay);
var showWeek = this._get(inst, 'showWeek');
var dayNames = this._get(inst, 'dayNames');
- var dayNamesShort = this._get(inst, 'dayNamesShort');
var dayNamesMin = this._get(inst, 'dayNamesMin');
var monthNames = this._get(inst, 'monthNames');
var monthNamesShort = this._get(inst, 'monthNamesShort');
var beforeShowDay = this._get(inst, 'beforeShowDay');
var showOtherMonths = this._get(inst, 'showOtherMonths');
var selectOtherMonths = this._get(inst, 'selectOtherMonths');
- var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
var defaultDate = this._getDefaultDate(inst);
var html = '';
for (var row = 0; row < numMonths[0]; row++) {
@@ -1539,8 +1540,8 @@ $.extend(Datepicker.prototype, {
calender += '">';
}
calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
- (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
- (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
+ (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : '') +
+ (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : '') +
this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
'</div><table class="ui-datepicker-calendar"><thead>' +
@@ -1599,14 +1600,13 @@ $.extend(Datepicker.prototype, {
drawMonth = 0;
drawYear++;
}
- calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
+ calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
group += calender;
}
html += group;
}
- html += buttonPanel + ($.ui.ie6 && !inst.inline ?
- '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
+ html += buttonPanel;
inst._keyEvent = false;
return html;
},
@@ -1647,8 +1647,8 @@ $.extend(Datepicker.prototype, {
var years = this._get(inst, 'yearRange').split(':');
var thisYear = new Date().getFullYear();
var determineYear = function(value) {
- var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
- (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
+ var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) :
+ (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) :
parseInt(value, 10)));
return (isNaN(year) ? thisYear : year);
};
@@ -1663,7 +1663,7 @@ $.extend(Datepicker.prototype, {
'>' + year + '</option>';
}
inst.yearshtml += '</select>';
-
+
html += inst.yearshtml;
inst.yearshtml = null;
}
@@ -1774,7 +1774,7 @@ $.extend(Datepicker.prototype, {
* Bind hover events for datepicker elements.
* Done via delegate so the binding only occurs once in the lifetime of the parent div.
* Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
- */
+ */
function bindHover(dpDiv) {
var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';
return dpDiv.delegate(selector, 'mouseout', function() {
@@ -1796,22 +1796,22 @@ function bindHover(dpDiv) {
function extendRemove(target, props) {
$.extend(target, props);
for (var name in props)
- if (props[name] == null || props[name] == undefined)
+ if (props[name] == null)
target[name] = props[name];
return target;
-};
+}
/* Invoke the datepicker functionality.
@param options string - a command, optionally followed by additional parameters or
- Object - settings for attaching new datepicker functionality
+ Object - settings for attaching new datepicker functionality
@return jQuery object */
$.fn.datepicker = function(options){
-
+
/* Verify an empty collection wasn't passed - Fixes #6976 */
if ( !this.length ) {
return this;
}
-
+
/* Initialise the date picker. */
if (!$.datepicker.initialized) {
$(document).mousedown($.datepicker._checkExternalClick).
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index 8593fff85..07c5c7cb6 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -19,7 +19,7 @@
*/
(function( $, undefined ) {
-var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ",
+var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ",
sizeRelatedOptions = {
buttons: true,
height: true,
@@ -67,10 +67,8 @@ $.widget("ui.dialog", {
},
resizable: true,
show: null,
- stack: true,
title: "",
- width: 300,
- zIndex: 1000
+ width: 300
},
_create: function() {
@@ -88,14 +86,15 @@ $.widget("ui.dialog", {
options = this.options,
title = options.title || "&#160;",
+ uiDialog,
+ uiDialogTitlebar,
+ uiDialogTitlebarClose,
+ uiDialogTitle,
+ uiDialogButtonPane;
uiDialog = ( this.uiDialog = $( "<div>" ) )
.addClass( uiDialogClasses + options.dialogClass )
- .css({
- display: "none",
- outline: 0, // TODO: move to stylesheet
- zIndex: options.zIndex
- })
+ .hide()
// setting tabIndex makes the div focusable
.attr( "tabIndex", -1)
.keydown(function( event ) {
@@ -106,20 +105,24 @@ $.widget("ui.dialog", {
}
})
.mousedown(function( event ) {
- that.moveToTop( false, event );
+ that.moveToTop( event );
})
- .appendTo( "body" ),
+ .appendTo( this.document[ 0 ].body );
- uiDialogContent = this.element
+ this.element
.show()
.removeAttr( "title" )
.addClass( "ui-dialog-content ui-widget-content" )
- .appendTo( uiDialog ),
+ .appendTo( uiDialog );
uiDialogTitlebar = ( this.uiDialogTitlebar = $( "<div>" ) )
.addClass( "ui-dialog-titlebar ui-widget-header " +
"ui-corner-all ui-helper-clearfix" )
- .prependTo( uiDialog ),
+ .bind( "mousedown", function() {
+ // Dialog isn't getting focus when dragging (#8063)
+ uiDialog.focus();
+ })
+ .prependTo( uiDialog );
uiDialogTitlebarClose = $( "<a href='#'></a>" )
.addClass( "ui-dialog-titlebar-close ui-corner-all" )
@@ -128,23 +131,23 @@ $.widget("ui.dialog", {
event.preventDefault();
that.close( event );
})
- .appendTo( uiDialogTitlebar ),
+ .appendTo( uiDialogTitlebar );
- uiDialogTitlebarCloseText = ( this.uiDialogTitlebarCloseText = $( "<span>" ) )
+ ( this.uiDialogTitlebarCloseText = $( "<span>" ) )
.addClass( "ui-icon ui-icon-closethick" )
.text( options.closeText )
- .appendTo( uiDialogTitlebarClose ),
+ .appendTo( uiDialogTitlebarClose );
uiDialogTitle = $( "<span>" )
.uniqueId()
.addClass( "ui-dialog-title" )
.html( title )
- .prependTo( uiDialogTitlebar ),
+ .prependTo( uiDialogTitlebar );
uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) )
- .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" ),
+ .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
- uiButtonSet = ( this.uiButtonSet = $( "<div>" ) )
+ ( this.uiButtonSet = $( "<div>" ) )
.addClass( "ui-dialog-buttonset" )
.appendTo( uiDialogButtonPane );
@@ -167,13 +170,9 @@ $.widget("ui.dialog", {
this._createButtons( options.buttons );
this._isOpen = false;
- if ( $.fn.bgiframe ) {
- uiDialog.bgiframe();
- }
-
- // prevent tabbing out of modal dialogs
+ // prevent tabbing out of dialogs
this._on( uiDialog, { keydown: function( event ) {
- if ( !options.modal || event.keyCode !== $.ui.keyCode.TAB ) {
+ if ( event.keyCode !== $.ui.keyCode.TAB ) {
return;
}
@@ -181,10 +180,10 @@ $.widget("ui.dialog", {
first = tabbables.filter( ":first" ),
last = tabbables.filter( ":last" );
- if ( event.target === last[0] && !event.shiftKey ) {
+ if ( ( event.target === last[ 0 ] || event.target === uiDialog[ 0 ] ) && !event.shiftKey ) {
first.focus( 1 );
return false;
- } else if ( event.target === first[0] && event.shiftKey ) {
+ } else if ( ( event.target === first[ 0 ] || event.target === uiDialog[ 0 ] ) && event.shiftKey ) {
last.focus( 1 );
return false;
}
@@ -229,8 +228,7 @@ $.widget("ui.dialog", {
},
close: function( event ) {
- var that = this,
- maxZ, thisZ;
+ var that = this;
if ( !this._isOpen ) {
return;
@@ -246,71 +244,27 @@ $.widget("ui.dialog", {
this.overlay.destroy();
}
- if ( this.options.hide ) {
- this.uiDialog.hide( this.options.hide, function() {
- that._trigger( "close", event );
- });
- } else {
- this.uiDialog.hide();
- this._trigger( "close", event );
+ if ( !this.opener.filter( ":focusable" ).focus().length ) {
+ // Hiding a focused element doesn't trigger blur in WebKit
+ // so in case we have nothing to focus on, explicitly blur the active element
+ // https://bugs.webkit.org/show_bug.cgi?id=47182
+ $( this.document[ 0 ].activeElement ).blur();
}
- $.ui.dialog.overlay.resize();
-
- // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
- if ( this.options.modal ) {
- maxZ = 0;
- $( ".ui-dialog" ).each(function() {
- if ( this !== that.uiDialog[0] ) {
- thisZ = $( this ).css( "z-index" );
- if ( !isNaN( thisZ ) ) {
- maxZ = Math.max( maxZ, thisZ );
- }
- }
- });
- $.ui.dialog.maxZ = maxZ;
- }
-
- return this;
+ this._hide( this.uiDialog, this.options.hide, function() {
+ that._trigger( "close", event );
+ });
},
isOpen: function() {
return this._isOpen;
},
- // the force parameter allows us to move modal dialogs to their correct
- // position on open
- moveToTop: function( force, event ) {
- var options = this.options,
- saveScroll;
-
- if ( ( options.modal && !force ) ||
- ( !options.stack && !options.modal ) ) {
- return this._trigger( "focus", event );
+ moveToTop: function( event, silent ) {
+ var moved = this.uiDialog.nextAll( ":visible" ).insertBefore( this.uiDialog );
+ if ( !silent && moved.length ) {
+ this._trigger( "focus", event );
}
-
- if ( options.zIndex > $.ui.dialog.maxZ ) {
- $.ui.dialog.maxZ = options.zIndex;
- }
- if ( this.overlay ) {
- $.ui.dialog.maxZ += 1;
- $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ;
- this.overlay.$el.css( "z-index", $.ui.dialog.overlay.maxZ );
- }
-
- // Save and then restore scroll
- // Opera 9.5+ resets when parent z-index is changed.
- // http://bugs.jqueryui.com/ticket/3193
- saveScroll = {
- scrollTop: this.element.scrollTop(),
- scrollLeft: this.element.scrollLeft()
- };
- $.ui.dialog.maxZ += 1;
- this.uiDialog.css( "z-index", $.ui.dialog.maxZ );
- this.element.attr( saveScroll );
- this._trigger( "focus", event );
-
- return this;
},
open: function() {
@@ -322,11 +276,13 @@ $.widget("ui.dialog", {
options = this.options,
uiDialog = this.uiDialog;
+ this.opener = $( this.document[ 0 ].activeElement );
+
this._size();
this._position( options.position );
- uiDialog.show( options.show );
this.overlay = options.modal ? new $.ui.dialog.overlay( this ) : null;
- this.moveToTop( true );
+ this.moveToTop( null, true );
+ this._show( uiDialog, options.show );
// set focus to the first tabbable element in the content area or the first button
// if there are no tabbable elements, set focus on the dialog itself
@@ -341,13 +297,30 @@ $.widget("ui.dialog", {
this._isOpen = true;
this._trigger( "open" );
+ this._trigger( "focus" );
return this;
},
+ _keepFocus: function( event ) {
+ function checkFocus() {
+ var activeElement = this.document[ 0 ].activeElement,
+ isActive = this.uiDialog[ 0 ] === activeElement ||
+ $.contains( this.uiDialog[ 0 ], activeElement );
+ if ( !isActive ) {
+ this.uiDialog.focus();
+ }
+ }
+ event.preventDefault();
+ checkFocus.call( this );
+ // support: IE
+ // IE <= 8 doesn't prevent moving focus even with event.preventDefault()
+ // so we check again later
+ this._delay( checkFocus );
+ },
+
_createButtons: function( buttons ) {
- var uiDialogButtonPane, uiButtonSet,
- that = this,
+ var that = this,
hasButtons = false;
// if we already have a button pane, remove it
@@ -361,15 +334,18 @@ $.widget("ui.dialog", {
}
if ( hasButtons ) {
$.each( buttons, function( name, props ) {
+ var button, click;
props = $.isFunction( props ) ?
{ click: props, text: name } :
props;
- var button = $( "<button type='button'></button>" )
- .attr( props, true )
- .unbind( "click" )
- .click(function() {
- props.click.apply( that.element[0], arguments );
- })
+ // Default to a non-submitting button
+ props = $.extend( { type: "button" }, props );
+ // Change the context for the click callback to be the main element
+ click = props.click;
+ props.click = function() {
+ click.apply( that.element[0], arguments );
+ };
+ button = $( "<button></button>", props )
.appendTo( that.uiButtonSet );
if ( $.fn.button ) {
button.button();
@@ -413,7 +389,6 @@ $.widget("ui.dialog", {
$( this )
.removeClass( "ui-dialog-dragging" );
that._trigger( "dragStop", event, filteredUi( ui ) );
- $.ui.dialog.overlay.resize();
}
});
},
@@ -459,7 +434,6 @@ $.widget("ui.dialog", {
options.height = $( this ).height();
options.width = $( this ).width();
that._trigger( "resizeStop", event, filteredUi( ui ) );
- $.ui.dialog.overlay.resize();
}
})
.css( "position", position )
@@ -501,9 +475,9 @@ $.widget("ui.dialog", {
});
position = {
- my: myAt.join( " " ),
- at: myAt.join( " " ),
- offset: offset.join( " " )
+ my: myAt[0] + (offset[0] < 0 ? offset[0] : "+" + offset[0]) + " " +
+ myAt[1] + (offset[1] < 0 ? offset[1] : "+" + offset[1]),
+ at: myAt.join( " " )
};
}
@@ -542,7 +516,7 @@ $.widget("ui.dialog", {
if ( resize ) {
this._size();
}
- if ( this.uiDialog.is( ":data(resizable)" ) ) {
+ if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
this.uiDialog.resizable( "option", resizableOptions );
}
},
@@ -572,7 +546,7 @@ $.widget("ui.dialog", {
}
break;
case "draggable":
- isDraggable = uiDialog.is( ":data(draggable)" );
+ isDraggable = uiDialog.is( ":data(ui-draggable)" );
if ( isDraggable && !value ) {
uiDialog.draggable( "destroy" );
}
@@ -586,7 +560,7 @@ $.widget("ui.dialog", {
break;
case "resizable":
// currently resizable, becoming non-resizable
- isResizable = uiDialog.is( ":data(resizable)" );
+ isResizable = uiDialog.is( ":data(ui-resizable)" );
if ( isResizable && !value ) {
uiDialog.resizable( "destroy" );
}
@@ -612,12 +586,11 @@ $.widget("ui.dialog", {
},
_size: function() {
- /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
- * divs will both have width and height set, so we need to reset them
- */
- var nonContentHeight, minContentHeight, autoHeight,
- options = this.options,
- isVisible = this.uiDialog.is( ":visible" );
+
+ // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
+ // divs will both have width and height set, so we need to reset them
+ var nonContentHeight, minContentHeight,
+ options = this.options;
// reset content sizing
this.element.show().css({
@@ -640,25 +613,15 @@ $.widget("ui.dialog", {
minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
if ( options.height === "auto" ) {
- // only needed for IE6 support
- if ( $.support.minHeight ) {
- this.element.css({
- minHeight: minContentHeight,
- height: "auto"
- });
- } else {
- this.uiDialog.show();
- autoHeight = this.element.css( "height", "auto" ).height();
- if ( !isVisible ) {
- this.uiDialog.hide();
- }
- this.element.height( Math.max( autoHeight, minContentHeight ) );
- }
+ this.element.css({
+ minHeight: minContentHeight,
+ height: "auto"
+ });
} else {
this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
}
- if (this.uiDialog.is( ":data(resizable)" ) ) {
+ if (this.uiDialog.is( ":data(ui-resizable)" ) ) {
this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
}
}
@@ -666,7 +629,6 @@ $.widget("ui.dialog", {
$.extend($.ui.dialog, {
uuid: 0,
- maxZ: 0,
getTitleId: function($el) {
var id = $el.attr( "id" );
@@ -686,66 +648,22 @@ $.extend( $.ui.dialog.overlay, {
instances: [],
// reuse old instances due to IE memory leak with alpha transparency (see #5185)
oldInstances: [],
- maxZ: 0,
- events: $.map(
- "focus,mousedown,mouseup,keydown,keypress,click".split( "," ),
- function( event ) {
- return event + ".dialog-overlay";
- }
- ).join( " " ),
create: function( dialog ) {
- if ( this.instances.length === 0 ) {
- // prevent use of anchors and inputs
- // we use a setTimeout in case the overlay is created from an
- // event that we're going to be cancelling (see #2804)
- setTimeout(function() {
- // handle $(el).dialog().dialog('close') (see #4065)
- if ( $.ui.dialog.overlay.instances.length ) {
- $( document ).bind( $.ui.dialog.overlay.events, function( event ) {
- // stop events if the z-index of the target is < the z-index of the overlay
- // we cannot return true when we don't want to cancel the event (#3523)
- if ( $( event.target ).zIndex() < $.ui.dialog.overlay.maxZ ) {
- return false;
- }
- });
- }
- }, 1 );
- // handle window resize
- $( window ).bind( "resize.dialog-overlay", $.ui.dialog.overlay.resize );
- }
+ var $el = ( this.oldInstances.pop() || $( "<div>" ).addClass( "ui-widget-overlay ui-front" ) );
- var $el = ( this.oldInstances.pop() || $( "<div>" ).addClass( "ui-widget-overlay" ) );
+ $el.appendTo( document.body );
- // allow closing by pressing the escape key
- $( document ).bind( "keydown.dialog-overlay", function( event ) {
- var instances = $.ui.dialog.overlay.instances;
- // only react to the event if we're the top overlay
- if ( instances.length !== 0 && instances[ instances.length - 1 ] === $el &&
- dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
- event.keyCode === $.ui.keyCode.ESCAPE ) {
-
- dialog.close( event );
- event.preventDefault();
- }
- });
-
- $el.appendTo( document.body ).css({
- width: this.width(),
- height: this.height()
+ $el.bind( "mousedown", function( event ) {
+ dialog._keepFocus( event );
});
- if ( $.fn.bgiframe ) {
- $el.bgiframe();
- }
-
this.instances.push( $el );
return $el;
},
destroy: function( $el ) {
- var indexOf = $.inArray( $el, this.instances ),
- maxZ = 0;
+ var indexOf = $.inArray( $el, this.instances );
if ( indexOf !== -1 ) {
this.oldInstances.push( this.instances.splice( indexOf, 1 )[ 0 ] );
@@ -755,86 +673,7 @@ $.extend( $.ui.dialog.overlay, {
$( [ document, window ] ).unbind( ".dialog-overlay" );
}
- $el.height( 0 ).width( 0 ).remove();
-
- // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
- $.each( this.instances, function() {
- maxZ = Math.max( maxZ, this.css( "z-index" ) );
- });
- this.maxZ = maxZ;
- },
-
- height: function() {
- var scrollHeight,
- offsetHeight;
- // handle IE
- if ( $.ui.ie ) {
- scrollHeight = Math.max(
- document.documentElement.scrollHeight,
- document.body.scrollHeight
- );
- offsetHeight = Math.max(
- document.documentElement.offsetHeight,
- document.body.offsetHeight
- );
-
- if ( scrollHeight < offsetHeight ) {
- return $( window ).height() + "px";
- } else {
- return scrollHeight + "px";
- }
- // handle "good" browsers
- } else {
- return $( document ).height() + "px";
- }
- },
-
- width: function() {
- var scrollWidth,
- offsetWidth;
- // handle IE
- if ( $.ui.ie ) {
- scrollWidth = Math.max(
- document.documentElement.scrollWidth,
- document.body.scrollWidth
- );
- offsetWidth = Math.max(
- document.documentElement.offsetWidth,
- document.body.offsetWidth
- );
-
- if ( scrollWidth < offsetWidth ) {
- return $( window ).width() + "px";
- } else {
- return scrollWidth + "px";
- }
- // handle "good" browsers
- } else {
- return $( document ).width() + "px";
- }
- },
-
- resize: function() {
- /* If the dialog is draggable and the user drags it past the
- * right edge of the window, the document becomes wider so we
- * need to stretch the overlay. If the user then drags the
- * dialog back to the left, the document will become narrower,
- * so we need to shrink the overlay to the appropriate size.
- * This is handled by shrinking the overlay before setting it
- * to the full document size.
- */
- var $overlays = $( [] );
- $.each( $.ui.dialog.overlay.instances, function() {
- $overlays = $overlays.add( this );
- });
-
- $overlays.css({
- width: 0,
- height: 0
- }).css({
- width: $.ui.dialog.overlay.width(),
- height: $.ui.dialog.overlay.height()
- });
+ $el.remove();
}
});
diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js
index 5d91a3d94..1f3c8d52c 100644
--- a/ui/jquery.ui.draggable.js
+++ b/ui/jquery.ui.draggable.js
@@ -15,6 +15,7 @@
*/
(function( $, undefined ) {
+/*jshint onevar: false, curly: false, eqeqeq: false, laxbreak: true, shadow: true, funcscope: true */
$.widget("ui.draggable", $.ui.mouse, {
version: "@VERSION",
widgetEventPrefix: "drag",
@@ -73,7 +74,7 @@ $.widget("ui.draggable", $.ui.mouse, {
this.handle = this._getHandle(event);
if (!this.handle)
return false;
-
+
$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
.css({
@@ -157,12 +158,12 @@ $.widget("ui.draggable", $.ui.mouse, {
if ($.ui.ddmanager && !o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this, event);
-
+
this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
-
+
//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);
-
+
return true;
},
@@ -201,7 +202,7 @@ $.widget("ui.draggable", $.ui.mouse, {
dropped = this.dropped;
this.dropped = false;
}
-
+
//if the original element is no longer in the DOM don't bother to continue (see #8269)
var element = this.element[0], elementInDom = false;
while ( element && (element = element.parentNode) ) {
@@ -227,29 +228,29 @@ $.widget("ui.draggable", $.ui.mouse, {
return false;
},
-
+
_mouseUp: function(event) {
//Remove frame helpers
- $("div.ui-draggable-iframeFix").each(function() {
- this.parentNode.removeChild(this);
+ $("div.ui-draggable-iframeFix").each(function() {
+ this.parentNode.removeChild(this);
});
-
+
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);
-
+
return $.ui.mouse.prototype._mouseUp.call(this, event);
},
-
+
cancel: function() {
-
+
if(this.helper.is(".ui-draggable-dragging")) {
this._mouseUp({});
} else {
this._clear();
}
-
+
return this;
-
+
},
_getHandle: function(event) {
@@ -372,7 +373,6 @@ $.widget("ui.draggable", $.ui.mouse, {
if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
var c = $(o.containment);
var ce = c[0]; if(!ce) return;
- var co = c.offset();
var over = ($(ce).css("overflow") != 'hidden');
this.containment = [
@@ -393,7 +393,7 @@ $.widget("ui.draggable", $.ui.mouse, {
if(!pos) pos = this.position;
var mod = d == "absolute" ? 1 : -1;
- var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+ var scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
return {
top: (
@@ -446,10 +446,10 @@ $.widget("ui.draggable", $.ui.mouse, {
if(o.grid) {
//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
- pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+ pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
- 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;
+ 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;
}
}
@@ -492,7 +492,7 @@ $.widget("ui.draggable", $.ui.mouse, {
plugins: {},
- _uiHash: function(event) {
+ _uiHash: function() {
return {
helper: this.helper,
position: this.position,
@@ -506,11 +506,11 @@ $.widget("ui.draggable", $.ui.mouse, {
$.ui.plugin.add("draggable", "connectToSortable", {
start: function(event, ui) {
- var inst = $(this).data("draggable"), o = inst.options,
+ var inst = $(this).data("ui-draggable"), o = inst.options,
uiSortable = $.extend({}, ui, { item: inst.element });
inst.sortables = [];
$(o.connectToSortable).each(function() {
- var sortable = $.data(this, 'sortable');
+ var sortable = $.data(this, 'ui-sortable');
if (sortable && !sortable.options.disabled) {
inst.sortables.push({
instance: sortable,
@@ -525,7 +525,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
stop: function(event, ui) {
//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
- var inst = $(this).data("draggable"),
+ var inst = $(this).data("ui-draggable"),
uiSortable = $.extend({}, ui, { item: inst.element });
$.each(inst.sortables, function() {
@@ -558,26 +558,17 @@ $.ui.plugin.add("draggable", "connectToSortable", {
},
drag: function(event, ui) {
- var inst = $(this).data("draggable"), that = this;
-
- var checkPos = function(o) {
- var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
- var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
- var itemHeight = o.height, itemWidth = o.width;
- var itemTop = o.top, itemLeft = o.left;
+ var inst = $(this).data("ui-draggable"), that = this;
- return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
- };
+ $.each(inst.sortables, function() {
- $.each(inst.sortables, function(i) {
-
var innermostIntersecting = false;
var thisSortable = this;
//Copy over some variables to allow calling the sortable's native _intersectsWith
this.instance.positionAbs = inst.positionAbs;
this.instance.helperProportions = inst.helperProportions;
this.instance.offset.click = inst.offset.click;
-
+
if(this.instance._intersectsWith(this.instance.containerCache)) {
innermostIntersecting = true;
$.each(inst.sortables, function () {
@@ -601,7 +592,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
//Now we fake the start of dragging for the sortable instance,
//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
- this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
+ this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("ui-sortable-item", true);
this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
this.instance.options.helper = function() { return ui.helper[0]; };
@@ -634,13 +625,13 @@ $.ui.plugin.add("draggable", "connectToSortable", {
this.instance.isOver = 0;
this.instance.cancelHelperRemoval = true;
-
+
//Prevent reverting on this forced stop
this.instance.options.revert = false;
-
+
// The out event needs to be triggered independently
this.instance._trigger('out', event, this.instance._uiHash(this.instance));
-
+
this.instance._mouseStop(event, true);
this.instance.options.helper = this.instance.options._helper;
@@ -652,7 +643,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
inst.dropped = false; //draggable revert needs that
}
- };
+ }
});
@@ -660,37 +651,37 @@ $.ui.plugin.add("draggable", "connectToSortable", {
});
$.ui.plugin.add("draggable", "cursor", {
- start: function(event, ui) {
- var t = $('body'), o = $(this).data('draggable').options;
+ start: function() {
+ var t = $('body'), o = $(this).data('ui-draggable').options;
if (t.css("cursor")) o._cursor = t.css("cursor");
t.css("cursor", o.cursor);
},
- stop: function(event, ui) {
- var o = $(this).data('draggable').options;
+ stop: function() {
+ var o = $(this).data('ui-draggable').options;
if (o._cursor) $('body').css("cursor", o._cursor);
}
});
$.ui.plugin.add("draggable", "opacity", {
start: function(event, ui) {
- var t = $(ui.helper), o = $(this).data('draggable').options;
+ var t = $(ui.helper), o = $(this).data('ui-draggable').options;
if(t.css("opacity")) o._opacity = t.css("opacity");
t.css('opacity', o.opacity);
},
stop: function(event, ui) {
- var o = $(this).data('draggable').options;
+ var o = $(this).data('ui-draggable').options;
if(o._opacity) $(ui.helper).css('opacity', o._opacity);
}
});
$.ui.plugin.add("draggable", "scroll", {
- start: function(event, ui) {
- var i = $(this).data("draggable");
+ start: function() {
+ var i = $(this).data("ui-draggable");
if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
},
- drag: function(event, ui) {
+ drag: function( event ) {
- var i = $(this).data("draggable"), o = i.options, scrolled = false;
+ var i = $(this).data("ui-draggable"), o = i.options, scrolled = false;
if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
@@ -733,12 +724,12 @@ $.ui.plugin.add("draggable", "scroll", {
});
$.ui.plugin.add("draggable", "snap", {
- start: function(event, ui) {
+ start: function() {
- var i = $(this).data("draggable"), o = i.options;
+ var i = $(this).data("ui-draggable"), o = i.options;
i.snapElements = [];
- $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
+ $(o.snap.constructor != String ? ( o.snap.items || ':data(ui-draggable)' ) : o.snap).each(function() {
var $t = $(this); var $o = $t.offset();
if(this != i.element[0]) i.snapElements.push({
item: this,
@@ -750,7 +741,7 @@ $.ui.plugin.add("draggable", "snap", {
},
drag: function(event, ui) {
- var inst = $(this).data("draggable"), o = inst.options;
+ var inst = $(this).data("ui-draggable"), o = inst.options;
var d = o.snapTolerance;
var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
@@ -796,22 +787,22 @@ $.ui.plugin.add("draggable", "snap", {
(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
- };
+ }
}
});
$.ui.plugin.add("draggable", "stack", {
- start: function(event, ui) {
+ start: function() {
- var o = $(this).data("draggable").options;
+ var o = $(this).data("ui-draggable").options;
var group = $.makeArray($(o.stack)).sort(function(a,b) {
return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
});
if (!group.length) { return; }
-
- var min = parseInt(group[0].style.zIndex) || 0;
+
+ var min = parseInt(group[0].style.zIndex, 10) || 0;
$(group).each(function(i) {
this.style.zIndex = min + i;
});
@@ -823,12 +814,12 @@ $.ui.plugin.add("draggable", "stack", {
$.ui.plugin.add("draggable", "zIndex", {
start: function(event, ui) {
- var t = $(ui.helper), o = $(this).data("draggable").options;
+ var t = $(ui.helper), o = $(this).data("ui-draggable").options;
if(t.css("zIndex")) o._zIndex = t.css("zIndex");
t.css('zIndex', o.zIndex);
},
stop: function(event, ui) {
- var o = $(this).data("draggable").options;
+ var o = $(this).data("ui-draggable").options;
if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
}
});
diff --git a/ui/jquery.ui.droppable.js b/ui/jquery.ui.droppable.js
index 93e74d211..f27d56b85 100644
--- a/ui/jquery.ui.droppable.js
+++ b/ui/jquery.ui.droppable.js
@@ -16,6 +16,7 @@
*/
(function( $, undefined ) {
+/*jshint onevar: false, curly: false, eqeqeq: false, laxbreak: true */
$.widget("ui.droppable", {
version: "@VERSION",
widgetEventPrefix: "drop",
@@ -109,8 +110,8 @@ $.widget("ui.droppable", {
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
var childrenIntersection = false;
- this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
- var inst = $.data(this, 'droppable');
+ this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function() {
+ var inst = $.data(this, 'ui-droppable');
if(
inst.options.greedy
&& !inst.options.disabled
@@ -156,33 +157,28 @@ $.ui.intersect = function(draggable, droppable, toleranceMode) {
case 'fit':
return (l <= x1 && x2 <= r
&& t <= y1 && y2 <= b);
- break;
case 'intersect':
return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
&& x2 - (draggable.helperProportions.width / 2) < r // Left Half
&& t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
&& y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
- break;
case 'pointer':
var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
return isOver;
- break;
case 'touch':
return (
- (y1 >= t && y1 <= b) || // Top edge touching
- (y2 >= t && y2 <= b) || // Bottom edge touching
- (y1 < t && y2 > b) // Surrounded vertically
- ) && (
- (x1 >= l && x1 <= r) || // Left edge touching
- (x2 >= l && x2 <= r) || // Right edge touching
- (x1 < l && x2 > r) // Surrounded horizontally
- );
- break;
+ (y1 >= t && y1 <= b) || // Top edge touching
+ (y2 >= t && y2 <= b) || // Bottom edge touching
+ (y1 < t && y2 > b) // Surrounded vertically
+ ) && (
+ (x1 >= l && x1 <= r) || // Left edge touching
+ (x2 >= l && x2 <= r) || // Right edge touching
+ (x1 < l && x2 > r) // Surrounded horizontally
+ );
default:
return false;
- break;
}
};
@@ -197,13 +193,19 @@ $.ui.ddmanager = {
var m = $.ui.ddmanager.droppables[t.options.scope] || [];
var type = event ? event.type : null; // workaround for #2317
- var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
+ var list = (t.currentItem || t.element).find(":data(ui-droppable)").andSelf();
droppablesLoop: for (var i = 0; i < m.length; i++) {
if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
- for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
- m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
+ // Filter out elements in the current dragged item
+ for (var j=0; j < list.length; j++) {
+ if(list[j] == m[i].element[0]) {
+ m[i].proportions.height = 0;
+ continue droppablesLoop;
+ }
+ }
+ m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
@@ -248,27 +250,27 @@ $.ui.ddmanager = {
if(this.options.disabled || this.greedyChild || !this.visible) return;
var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
- var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
+ var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover === 0 ? 'isover' : null);
if(!c) return;
var parentInstance;
if (this.options.greedy) {
// find droppable parents with same scope
var scope = this.options.scope;
- var parent = this.element.parents(':data(droppable)').filter(function () {
- return $.data(this, 'droppable').options.scope === scope;
+ var parent = this.element.parents(':data(ui-droppable)').filter(function () {
+ return $.data(this, 'ui-droppable').options.scope === scope;
});
if (parent.length) {
- parentInstance = $.data(parent[0], 'droppable');
+ parentInstance = $.data(parent[0], 'ui-droppable');
parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
}
}
// we just moved into a greedy child
if (parentInstance && c == 'isover') {
- parentInstance['isover'] = 0;
- parentInstance['isout'] = 1;
+ parentInstance.isover = 0;
+ parentInstance.isout = 1;
parentInstance._out.call(parentInstance, event);
}
@@ -277,8 +279,8 @@ $.ui.ddmanager = {
// we just moved out of a greedy child
if (parentInstance && c == 'isout') {
- parentInstance['isout'] = 0;
- parentInstance['isover'] = 1;
+ parentInstance.isout = 0;
+ parentInstance.isover = 1;
parentInstance._over.call(parentInstance, event);
}
});
diff --git a/ui/jquery.ui.effect-highlight.js b/ui/jquery.ui.effect-highlight.js
index 0b0dbd988..99c41de2f 100644
--- a/ui/jquery.ui.effect-highlight.js
+++ b/ui/jquery.ui.effect-highlight.js
@@ -26,7 +26,7 @@ $.effects.effect.highlight = function( o, done ) {
}
$.effects.save( elem, props );
-
+
elem
.show()
.css({
diff --git a/ui/jquery.ui.effect-scale.js b/ui/jquery.ui.effect-scale.js
index 933530a67..7fa04bed6 100644
--- a/ui/jquery.ui.effect-scale.js
+++ b/ui/jquery.ui.effect-scale.js
@@ -102,8 +102,9 @@ $.effects.effect.scale = function( o, done ) {
$.effects.effect.size = function( o, done ) {
// Create element
- var el = $( this ),
- props = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
+ var original, baseline, factor,
+ el = $( this ),
+ props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
// Always restore
props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
@@ -119,8 +120,12 @@ $.effects.effect.size = function( o, done ) {
restore = o.restore || mode !== "effect",
scale = o.scale || "both",
origin = o.origin || [ "middle", "center" ],
- original, baseline, factor,
- position = el.css( "position" );
+ position = el.css( "position" ),
+ props = restore ? props0 : props1,
+ zero = {
+ height: 0,
+ width: 0
+ };
if ( mode === "show" ) {
el.show();
@@ -132,8 +137,13 @@ $.effects.effect.size = function( o, done ) {
outerWidth: el.outerWidth()
};
- el.from = o.from || original;
- el.to = o.to || original;
+ if ( o.mode === "toggle" && mode === "show" ) {
+ el.from = o.to || zero;
+ el.to = o.from || original;
+ } else {
+ el.from = o.from || ( mode === "show" ? zero : original );
+ el.to = o.to || ( mode === "hide" ? zero : original );
+ }
// Set scaling factor
factor = {
@@ -170,13 +180,13 @@ $.effects.effect.size = function( o, done ) {
// Vertical props scaling
if ( factor.from.y !== factor.to.y ) {
- props = props.concat( cProps );
+ props = props.concat( cProps ).concat( props2 );
el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
}
}
- $.effects.save( el, restore ? props : props1 );
+ $.effects.save( el, props );
el.show();
$.effects.createWrapper( el );
el.css( "overflow", "hidden" ).css( el.from );
@@ -197,7 +207,7 @@ $.effects.effect.size = function( o, done ) {
// Add margins/font-size
vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
hProps = hProps.concat([ "marginLeft", "marginRight" ]);
- props2 = props.concat(vProps).concat(hProps);
+ props2 = props0.concat(vProps).concat(hProps);
el.find( "*[width]" ).each( function(){
var child = $( this ),
@@ -254,7 +264,7 @@ $.effects.effect.size = function( o, done ) {
if( mode === "hide" ) {
el.hide();
}
- $.effects.restore( el, restore ? props : props1 );
+ $.effects.restore( el, props );
if ( !restore ) {
// we need to calculate our new positioning based on the scaling
diff --git a/ui/jquery.ui.effect.js b/ui/jquery.ui.effect.js
index d5d306783..fee3359bf 100644
--- a/ui/jquery.ui.effect.js
+++ b/ui/jquery.ui.effect.js
@@ -10,9 +10,7 @@
*/
;(jQuery.effects || (function($, undefined) {
-var backCompat = $.uiBackCompat !== false,
- // prefix used for storing data on .data()
- dataSpace = "ui-effects-";
+var dataSpace = "ui-effects-";
$.effects = {
effect: {}
@@ -245,8 +243,7 @@ color.fn = jQuery.extend( color.prototype, {
var inst = this,
type = jQuery.type( red ),
- rgba = this._rgba = [],
- source;
+ rgba = this._rgba = [];
// more than 1 argument specified - assume ( red, green, blue, alpha )
if ( green !== undefined ) {
@@ -427,7 +424,7 @@ color.fn = jQuery.extend( color.prototype, {
rgba.push( ~~( alpha * 255 ) );
}
- return "#" + jQuery.map( rgba, function( v, i ) {
+ return "#" + jQuery.map( rgba, function( v ) {
// default to 0 when nulls exist
v = ( v || 0 ).toString( 16 );
@@ -501,8 +498,7 @@ spaces.hsla.from = function ( hsla ) {
l = hsla[ 2 ],
a = hsla[ 3 ],
q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
- p = 2 * l - q,
- r, g, b;
+ p = 2 * l - q;
return [
Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
@@ -619,7 +615,7 @@ each( stepHooks, function( i, hook ) {
}
try {
elem.style[ hook ] = value;
- } catch( value ) {
+ } catch( error ) {
// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
}
}
@@ -704,33 +700,31 @@ $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopS
};
});
-function getElementStyles() {
- var style = this.ownerDocument.defaultView ?
- this.ownerDocument.defaultView.getComputedStyle( this, null ) :
- this.currentStyle,
- newStyle = {},
- key,
- camelCase,
- len;
+function getElementStyles( elem ) {
+ var key, len,
+ style = elem.ownerDocument.defaultView ?
+ elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
+ elem.currentStyle,
+ styles = {};
- // webkit enumerates style porperties
if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
len = style.length;
while ( len-- ) {
key = style[ len ];
if ( typeof style[ key ] === "string" ) {
- newStyle[ $.camelCase( key ) ] = style[ key ];
+ styles[ $.camelCase( key ) ] = style[ key ];
}
}
+ // support: Opera, IE <9
} else {
for ( key in style ) {
if ( typeof style[ key ] === "string" ) {
- newStyle[ key ] = style[ key ];
+ styles[ key ] = style[ key ];
}
}
}
- return newStyle;
+ return styles;
}
@@ -766,7 +760,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
var el = $( this );
return {
el: el,
- start: getElementStyles.call( this )
+ start: getElementStyles( this )
};
});
@@ -782,7 +776,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
// map all animated objects again - calculate new styles and diff
allAnimations = allAnimations.map(function() {
- this.end = getElementStyles.call( this.el[ 0 ] );
+ this.end = getElementStyles( this.el[ 0 ] );
this.diff = styleDifference( this.start, this.end );
return this;
});
@@ -1045,7 +1039,7 @@ $.extend( $.effects, {
// return an effect options object for the given parameters:
function _normalizeArguments( effect, options, speed, callback ) {
- // allow passing all optinos as the first parameter
+ // allow passing all options as the first parameter
if ( $.isPlainObject( effect ) ) {
options = effect;
effect = effect.effect;
@@ -1054,8 +1048,8 @@ function _normalizeArguments( effect, options, speed, callback ) {
// convert to an object
effect = { effect: effect };
- // catch (effect)
- if ( options === undefined ) {
+ // catch (effect, null, ...)
+ if ( options == null ) {
options = {};
}
@@ -1102,28 +1096,17 @@ function standardSpeed( speed ) {
}
// invalid strings - treat as "normal" speed
- if ( typeof speed === "string" && !$.effects.effect[ speed ] ) {
- // TODO: remove in 2.0 (#7115)
- if ( backCompat && $.effects[ speed ] ) {
- return false;
- }
- return true;
- }
-
- return false;
+ return typeof speed === "string" && !$.effects.effect[ speed ];
}
$.fn.extend({
- effect: function( effect, options, speed, callback ) {
+ effect: function( /* effect, options, speed, callback */ ) {
var args = _normalizeArguments.apply( this, arguments ),
mode = args.mode,
queue = args.queue,
- effectMethod = $.effects.effect[ args.effect ],
+ effectMethod = $.effects.effect[ args.effect ];
- // DEPRECATED: remove in 2.0 (#7115)
- oldEffectMethod = !effectMethod && backCompat && $.effects[ args.effect ];
-
- if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) {
+ if ( $.fx.off || !effectMethod ) {
// delegate to the original method (e.g., .show()) if possible
if ( mode ) {
return this[ mode ]( args.duration, args.complete );
@@ -1159,18 +1142,7 @@ $.fn.extend({
}
}
- // TODO: remove this check in 2.0, effectMethod will always be true
- if ( effectMethod ) {
- return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
- } else {
- // DEPRECATED: remove in 2.0 (#7115)
- return oldEffectMethod.call(this, {
- options: args,
- duration: args.duration,
- callback: args.complete,
- mode: args.mode
- });
- }
+ return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
},
_show: $.fn.show,
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 5d401da53..45c1ec2e4 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -277,21 +277,35 @@ $.widget( "ui.menu", {
},
refresh: function() {
- // Initialize nested menus
var menus,
icon = this.options.icons.submenu,
- submenus = this.element.find( this.options.menus + ":not(.ui-menu)" )
- .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
- .hide()
- .attr({
- role: this.options.role,
- "aria-hidden": "true",
- "aria-expanded": "false"
- });
+ submenus = this.element.find( this.options.menus );
+
+ // Initialize nested menus
+ submenus.filter( ":not(.ui-menu)" )
+ .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+ .hide()
+ .attr({
+ role: this.options.role,
+ "aria-hidden": "true",
+ "aria-expanded": "false"
+ })
+ .each(function() {
+ var menu = $( this ),
+ item = menu.prev( "a" ),
+ submenuCarat = $( "<span>" )
+ .addClass( "ui-menu-icon ui-icon " + icon )
+ .data( "ui-menu-submenu-carat", true );
+
+ item
+ .attr( "aria-haspopup", "true" )
+ .prepend( submenuCarat );
+ menu.attr( "aria-labelledby", item.attr( "id" ) );
+ });
- // Don't refresh list items that are already adapted
menus = submenus.add( this.element );
+ // Don't refresh list items that are already adapted
menus.children( ":not(.ui-menu-item):has(a)" )
.addClass( "ui-menu-item" )
.attr( "role", "presentation" )
@@ -315,19 +329,6 @@ $.widget( "ui.menu", {
// Add aria-disabled attribute to any disabled menu item
menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
- submenus.each(function() {
- var menu = $( this ),
- item = menu.prev( "a" ),
- submenuCarat = $( "<span>" )
- .addClass( "ui-menu-icon ui-icon " + icon )
- .data( "ui-menu-submenu-carat", true );
-
- item
- .attr( "aria-haspopup", "true" )
- .prepend( submenuCarat );
- menu.attr( "aria-labelledby", item.attr( "id" ) );
- });
-
// If the active item has been removed, blur the menu
if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
this.blur();
diff --git a/ui/jquery.ui.mouse.js b/ui/jquery.ui.mouse.js
index f5069d00c..6abd5ceaf 100644
--- a/ui/jquery.ui.mouse.js
+++ b/ui/jquery.ui.mouse.js
@@ -14,7 +14,7 @@
(function( $, undefined ) {
var mouseHandled = false;
-$( document ).mouseup( function( e ) {
+$( document ).mouseup( function() {
mouseHandled = false;
});
@@ -104,14 +104,14 @@ $.widget("ui.mouse", {
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
event.preventDefault();
-
+
mouseHandled = true;
return true;
},
_mouseMove: function(event) {
// IE mouseup check - mouseup happened when mouse was out of window
- if ($.ui.ie && !(document.documentMode >= 9) && !event.button) {
+ if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
return this._mouseUp(event);
}
@@ -155,15 +155,15 @@ $.widget("ui.mouse", {
);
},
- _mouseDelayMet: function(event) {
+ _mouseDelayMet: function(/* event */) {
return this.mouseDelayMet;
},
// These are placeholder methods, to be overriden by extending plugin
- _mouseStart: function(event) {},
- _mouseDrag: function(event) {},
- _mouseStop: function(event) {},
- _mouseCapture: function(event) { return true; }
+ _mouseStart: function(/* event */) {},
+ _mouseDrag: function(/* event */) {},
+ _mouseStop: function(/* event */) {},
+ _mouseCapture: function(/* event */) { return true; }
});
})(jQuery);
diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js
index 5b595a8c0..a5dc31834 100644
--- a/ui/jquery.ui.position.js
+++ b/ui/jquery.ui.position.js
@@ -230,10 +230,6 @@ $.fn.position = function( options ) {
}
});
- if ( $.fn.bgiframe ) {
- elem.bgiframe();
- }
-
if ( options.using ) {
// adds feedback as second argument to using callback, if present
using = function( props ) {
@@ -478,40 +474,4 @@ $.ui.position = {
testElementParent.removeChild( testElement );
})();
-// DEPRECATED
-if ( $.uiBackCompat !== false ) {
- // offset option
- (function( $ ) {
- var _position = $.fn.position;
- $.fn.position = function( options ) {
- if ( !options || !options.offset ) {
- return _position.call( this, options );
- }
- var offset = options.offset.split( " " ),
- at = options.at.split( " " );
- if ( offset.length === 1 ) {
- offset[ 1 ] = offset[ 0 ];
- }
- if ( /^\d/.test( offset[ 0 ] ) ) {
- offset[ 0 ] = "+" + offset[ 0 ];
- }
- if ( /^\d/.test( offset[ 1 ] ) ) {
- offset[ 1 ] = "+" + offset[ 1 ];
- }
- if ( at.length === 1 ) {
- if ( /left|center|right/.test( at[ 0 ] ) ) {
- at[ 1 ] = "center";
- } else {
- at[ 1 ] = at[ 0 ];
- at[ 0 ] = "center";
- }
- }
- return _position.call( this, $.extend( options, {
- at: at[ 0 ] + offset[ 0 ] + " " + at[ 1 ] + offset[ 1 ],
- offset: undefined
- } ) );
- };
- }( jQuery ) );
-}
-
}( jQuery ) );
diff --git a/ui/jquery.ui.progressbar.js b/ui/jquery.ui.progressbar.js
index cb561ebc6..5a7fd87d3 100644
--- a/ui/jquery.ui.progressbar.js
+++ b/ui/jquery.ui.progressbar.js
@@ -24,19 +24,22 @@ $.widget( "ui.progressbar", {
min: 0,
_create: function() {
+ // Constrain initial value
+ this.options.value = this._constrainedValue();
+
this.element
.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.attr({
role: "progressbar",
"aria-valuemin": this.min,
"aria-valuemax": this.options.max,
- "aria-valuenow": this._value()
+ "aria-valuenow": this.options.value
});
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
.appendTo( this.element );
- this.oldValue = this._value();
+ this.oldValue = this.options.value;
this._refreshValue();
},
@@ -53,52 +56,82 @@ $.widget( "ui.progressbar", {
value: function( newValue ) {
if ( newValue === undefined ) {
- return this._value();
+ return this.options.value;
}
- this._setOption( "value", newValue );
+ this._setOption( "value", this._constrainedValue( newValue ) );
return this;
},
- _setOption: function( key, value ) {
- if ( key === "value" ) {
- this.options.value = value;
- this._refreshValue();
- if ( this._value() === this.options.max ) {
- this._trigger( "complete" );
- }
+ _constrainedValue: function( newValue ) {
+ var val;
+ if ( newValue === undefined ) {
+ val = this.options.value;
+ } else {
+ val = newValue;
}
- this._super( key, value );
- },
-
- _value: function() {
- var val = this.options.value;
- // normalize invalid value
+ // sanitize value
if ( typeof val !== "number" ) {
val = 0;
}
return Math.min( this.options.max, Math.max( this.min, val ) );
},
+ _setOptions: function( options ) {
+ var key, val;
+
+ for ( key in options ) {
+ if ( key === "value" ) {
+ // Store value to update last in case max is being updated at the same time
+ val = options[ key ];
+ } else {
+ this._setOption( key, options[ key ] );
+ }
+ }
+
+ if ( val !== undefined ) {
+ this._setOption( "value", val );
+ }
+ },
+
+ _setOption: function( key, value ) {
+ if ( key === "max" ) {
+ // Don't allow a max less than min
+ this.options.max = Math.max( this.min, value );
+ this.options.value = this._constrainedValue();
+ }
+ if ( key === "value" ) {
+ this.options.value = this._constrainedValue( value );
+ }
+ else {
+ this._super( key, value );
+ }
+
+ this._refreshValue();
+ },
+
_percentage: function() {
- return 100 * this._value() / this.options.max;
+ return 100 * this.options.value / this.options.max;
},
_refreshValue: function() {
- var value = this.value(),
- percentage = this._percentage();
+ var percentage = this._percentage();
- if ( this.oldValue !== value ) {
- this.oldValue = value;
+ if ( this.oldValue !== this.options.value ) {
+ this.oldValue = this.options.value;
this._trigger( "change" );
}
+ if ( this.options.value === this.options.max ) {
+ this._trigger( "complete" );
+ }
this.valueDiv
- .toggle( value > this.min )
- .toggleClass( "ui-corner-right", value === this.options.max )
+ .toggle( this.options.value > this.min )
+ .toggleClass( "ui-corner-right", this.options.value === this.options.max )
.width( percentage.toFixed(0) + "%" );
- this.element.attr( "aria-valuenow", value );
+ this.element.attr( "aria-valuemax", this.options.max );
+ this.element.attr( "aria-valuenow", this.options.value );
}
});
diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js
index cc82b8b92..fba9216e1 100644
--- a/ui/jquery.ui.resizable.js
+++ b/ui/jquery.ui.resizable.js
@@ -15,6 +15,16 @@
*/
(function( $, undefined ) {
+/*jshint onevar: false, curly: false, eqeqeq: false, funcscope: true, loopfunc: true */
+
+function num(v) {
+ return parseInt(v, 10) || 0;
+}
+
+function isNumber(value) {
+ return !isNaN(parseInt(value, 10));
+}
+
$.widget("ui.resizable", $.ui.mouse, {
version: "@VERSION",
widgetEventPrefix: "resize",
@@ -65,7 +75,7 @@ $.widget("ui.resizable", $.ui.mouse, {
//Overwrite the original this.element
this.element = this.element.parent().data(
- "resizable", this.element.data('resizable')
+ "ui-resizable", this.element.data('ui-resizable')
);
this.elementIsWrapper = true;
@@ -106,7 +116,7 @@ $.widget("ui.resizable", $.ui.mouse, {
//TODO : What's going on here?
if ('se' == handle) {
axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
- };
+ }
//Insert into internal handles object and append to element
this.handles[handle] = '.ui-resizable-'+handle;
@@ -204,15 +214,14 @@ $.widget("ui.resizable", $.ui.mouse, {
if (this.elementIsWrapper) {
_destroy(this.element);
var wrapper = this.element;
- wrapper.after(
- this.originalElement.css({
- position: wrapper.css('position'),
- width: wrapper.outerWidth(),
- height: wrapper.outerHeight(),
- top: wrapper.css('top'),
- left: wrapper.css('left')
- })
- ).remove();
+ this.originalElement.css({
+ position: wrapper.css('position'),
+ width: wrapper.outerWidth(),
+ height: wrapper.outerHeight(),
+ top: wrapper.css('top'),
+ left: wrapper.css('left')
+ }).insertAfter( wrapper );
+ wrapper.remove();
}
this.originalElement.css('resize', this.originalResizeStyle);
@@ -222,14 +231,15 @@ $.widget("ui.resizable", $.ui.mouse, {
},
_mouseCapture: function(event) {
- var handle = false;
+ var capture = false;
for (var i in this.handles) {
- if ($(this.handles[i])[0] == event.target) {
- handle = true;
+ var handle = $(this.handles[i])[0];
+ if (handle == event.target || $.contains(handle, event.target)) {
+ capture = true;
}
}
- return !this.options.disabled && handle;
+ return !this.options.disabled && capture;
},
_mouseStart: function(event) {
@@ -276,8 +286,8 @@ $.widget("ui.resizable", $.ui.mouse, {
_mouseDrag: function(event) {
//Increase performance, avoid regex
- var el = this.helper, o = this.options, props = {},
- that = this, smp = this.originalMousePosition, a = this.axis;
+ var el = this.helper,
+ smp = this.originalMousePosition, a = this.axis;
var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
var trigger = this._change[a];
@@ -373,7 +383,6 @@ $.widget("ui.resizable", $.ui.mouse, {
},
_updateCache: function(data) {
- var o = this.options;
this.offset = this.helper.offset();
if (isNumber(data.left)) this.position.left = data.left;
if (isNumber(data.top)) this.position.top = data.top;
@@ -381,9 +390,9 @@ $.widget("ui.resizable", $.ui.mouse, {
if (isNumber(data.width)) this.size.width = data.width;
},
- _updateRatio: function(data, event) {
+ _updateRatio: function( data ) {
- var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
+ var cpos = this.position, csize = this.size, a = this.axis;
if (isNumber(data.height)) data.width = (data.height * this.aspectRatio);
else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio);
@@ -400,11 +409,11 @@ $.widget("ui.resizable", $.ui.mouse, {
return data;
},
- _respectSize: function(data, event) {
+ _respectSize: function( data ) {
- var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
- ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
- isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
+ var o = this._vBoundaries, a = this.axis,
+ ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
+ isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
if (isminw) data.width = o.minWidth;
if (isminh) data.height = o.minHeight;
@@ -429,7 +438,6 @@ $.widget("ui.resizable", $.ui.mouse, {
_proportionallyResize: function() {
- var o = this.options;
if (!this._proportionallyResizeElements.length) return;
var element = this.helper || this.element;
@@ -452,7 +460,7 @@ $.widget("ui.resizable", $.ui.mouse, {
width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
});
- };
+ }
},
@@ -465,16 +473,12 @@ $.widget("ui.resizable", $.ui.mouse, {
this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
- // fix ie6 offset TODO: This seems broken
- var ie6offset = ($.ui.ie6 ? 1 : 0),
- pxyoffset = ( $.ui.ie6 ? 2 : -1 );
-
this.helper.addClass(this._helper).css({
- width: this.element.outerWidth() + pxyoffset,
- height: this.element.outerHeight() + pxyoffset,
+ width: this.element.outerWidth() - 1,
+ height: this.element.outerHeight() - 1,
position: 'absolute',
- left: this.elementOffset.left - ie6offset +'px',
- top: this.elementOffset.top - ie6offset +'px',
+ left: this.elementOffset.left +'px',
+ top: this.elementOffset.top +'px',
zIndex: ++o.zIndex //TODO: Don't modify option
});
@@ -489,15 +493,15 @@ $.widget("ui.resizable", $.ui.mouse, {
},
_change: {
- e: function(event, dx, dy) {
+ e: function(event, dx) {
return { width: this.originalSize.width + dx };
},
- w: function(event, dx, dy) {
- var o = this.options, cs = this.originalSize, sp = this.originalPosition;
+ w: function(event, dx) {
+ var cs = this.originalSize, sp = this.originalPosition;
return { left: sp.left + dx, width: cs.width - dx };
},
n: function(event, dx, dy) {
- var o = this.options, cs = this.originalSize, sp = this.originalPosition;
+ var cs = this.originalSize, sp = this.originalPosition;
return { top: sp.top + dy, height: cs.height - dy };
},
s: function(event, dx, dy) {
@@ -544,13 +548,13 @@ $.widget("ui.resizable", $.ui.mouse, {
$.ui.plugin.add("resizable", "alsoResize", {
- start: function (event, ui) {
- var that = $(this).data("resizable"), o = that.options;
+ start: function () {
+ var that = $(this).data("ui-resizable"), o = that.options;
var _store = function (exp) {
$(exp).each(function() {
var el = $(this);
- el.data("resizable-alsoresize", {
+ el.data("ui-resizable-alsoresize", {
width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10)
});
@@ -566,7 +570,7 @@ $.ui.plugin.add("resizable", "alsoResize", {
},
resize: function (event, ui) {
- var that = $(this).data("resizable"), o = that.options, os = that.originalSize, op = that.originalPosition;
+ var that = $(this).data("ui-resizable"), o = that.options, os = that.originalSize, op = that.originalPosition;
var delta = {
height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0,
@@ -575,7 +579,7 @@ $.ui.plugin.add("resizable", "alsoResize", {
_alsoResize = function (exp, c) {
$(exp).each(function() {
- var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
+ var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
$.each(css, function (i, prop) {
@@ -595,15 +599,15 @@ $.ui.plugin.add("resizable", "alsoResize", {
}
},
- stop: function (event, ui) {
+ stop: function () {
$(this).removeData("resizable-alsoresize");
}
});
$.ui.plugin.add("resizable", "animate", {
- stop: function(event, ui) {
- var that = $(this).data("resizable"), o = that.options;
+ stop: function( event ) {
+ var that = $(this).data("ui-resizable"), o = that.options;
var pr = that._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height,
@@ -641,8 +645,8 @@ $.ui.plugin.add("resizable", "animate", {
$.ui.plugin.add("resizable", "containment", {
- start: function(event, ui) {
- var that = $(this).data("resizable"), o = that.options, el = that.element;
+ start: function() {
+ var that = $(this).data("ui-resizable"), o = that.options, el = that.element;
var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
if (!ce) return;
@@ -676,10 +680,10 @@ $.ui.plugin.add("resizable", "containment", {
}
},
- resize: function(event, ui) {
- var that = $(this).data("resizable"), o = that.options,
- ps = that.containerSize, co = that.containerOffset, cs = that.size, cp = that.position,
- pRatio = that._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = that.containerElement;
+ resize: function( event ) {
+ var that = $(this).data("ui-resizable"), o = that.options,
+ co = that.containerOffset, cp = that.position,
+ pRatio = that._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = that.containerElement;
if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
@@ -717,8 +721,8 @@ $.ui.plugin.add("resizable", "containment", {
}
},
- stop: function(event, ui){
- var that = $(this).data("resizable"), o = that.options, cp = that.position,
+ stop: function(){
+ var that = $(this).data("ui-resizable"), o = that.options,
co = that.containerOffset, cop = that.containerPosition, ce = that.containerElement;
var helper = $(that.helper), ho = helper.offset(), w = helper.outerWidth() - that.sizeDiff.width, h = helper.outerHeight() - that.sizeDiff.height;
@@ -734,13 +738,13 @@ $.ui.plugin.add("resizable", "containment", {
$.ui.plugin.add("resizable", "ghost", {
- start: function(event, ui) {
+ start: function() {
- var that = $(this).data("resizable"), o = that.options, cs = that.size;
+ var that = $(this).data("ui-resizable"), o = that.options, cs = that.size;
that.ghost = that.originalElement.clone();
that.ghost
- .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
+ .css({ opacity: 0.25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
.addClass('ui-resizable-ghost')
.addClass(typeof o.ghost == 'string' ? o.ghost : '');
@@ -748,13 +752,13 @@ $.ui.plugin.add("resizable", "ghost", {
},
- resize: function(event, ui){
- var that = $(this).data("resizable"), o = that.options;
+ resize: function(){
+ var that = $(this).data("ui-resizable");
if (that.ghost) that.ghost.css({ position: 'relative', height: that.size.height, width: that.size.width });
},
- stop: function(event, ui){
- var that = $(this).data("resizable"), o = that.options;
+ stop: function() {
+ var that = $(this).data("ui-resizable");
if (that.ghost && that.helper) that.helper.get(0).removeChild(that.ghost.get(0));
}
@@ -762,28 +766,42 @@ $.ui.plugin.add("resizable", "ghost", {
$.ui.plugin.add("resizable", "grid", {
- resize: function(event, ui) {
- var that = $(this).data("resizable"), o = that.options, cs = that.size, os = that.originalSize, op = that.originalPosition, a = that.axis, ratio = o._aspectRatio || event.shiftKey;
+ resize: function() {
+ var that = $(this).data("ui-resizable"), o = that.options, cs = that.size, os = that.originalSize, op = that.originalPosition, a = that.axis;
o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
- var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);
+ var gridX = (o.grid[0]||1), gridY = (o.grid[1]||1),
+ ox = Math.round((cs.width - os.width) / gridX) * gridX, oy = Math.round((cs.height - os.height) / gridY) * gridY,
+ newWidth = os.width + ox, newHeight = os.height + oy,
+ isMaxWidth = o.maxWidth && (o.maxWidth < newWidth), isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
+ isMinWidth = o.minWidth && (o.minWidth > newWidth), isMinHeight = o.minHeight && (o.minHeight > newHeight);
+
+ if (isMinWidth) {
+ newWidth = newWidth + gridX;
+ }
+ if (isMinHeight) {
+ newHeight = newHeight + gridY;
+ }
+ if (isMaxWidth) {
+ newWidth = newWidth - gridX;
+ }
+ if (isMaxHeight) {
+ newHeight = newHeight - gridY;
+ }
if (/^(se|s|e)$/.test(a)) {
- that.size.width = os.width + ox;
- that.size.height = os.height + oy;
- }
- else if (/^(ne)$/.test(a)) {
- that.size.width = os.width + ox;
- that.size.height = os.height + oy;
+ that.size.width = newWidth;
+ that.size.height = newHeight;
+ } else if (/^(ne)$/.test(a)) {
+ that.size.width = newWidth;
+ that.size.height = newHeight;
that.position.top = op.top - oy;
- }
- else if (/^(sw)$/.test(a)) {
- that.size.width = os.width + ox;
- that.size.height = os.height + oy;
+ } else if (/^(sw)$/.test(a)) {
+ that.size.width = newWidth;
+ that.size.height = newHeight;
that.position.left = op.left - ox;
- }
- else {
- that.size.width = os.width + ox;
- that.size.height = os.height + oy;
+ } else {
+ that.size.width = newWidth;
+ that.size.height = newHeight;
that.position.top = op.top - oy;
that.position.left = op.left - ox;
}
@@ -791,12 +809,4 @@ $.ui.plugin.add("resizable", "grid", {
});
-var num = function(v) {
- return parseInt(v, 10) || 0;
-};
-
-var isNumber = function(value) {
- return !isNaN(parseInt(value, 10));
-};
-
})(jQuery);
diff --git a/ui/jquery.ui.selectable.js b/ui/jquery.ui.selectable.js
index 80e32ca7a..a9b15b20b 100644
--- a/ui/jquery.ui.selectable.js
+++ b/ui/jquery.ui.selectable.js
@@ -25,20 +25,20 @@ $.widget("ui.selectable", $.ui.mouse, {
tolerance: 'touch'
},
_create: function() {
- var that = this;
+ var selectees,
+ that = this;
this.element.addClass("ui-selectable");
this.dragged = false;
// cache selectee children based on filter
- var selectees;
this.refresh = function() {
selectees = $(that.options.filter, that.element[0]);
selectees.addClass("ui-selectee");
selectees.each(function() {
- var $this = $(this);
- var pos = $this.offset();
+ var $this = $(this),
+ pos = $this.offset();
$.data(this, "selectable-item", {
element: this,
$element: $this,
@@ -72,14 +72,14 @@ $.widget("ui.selectable", $.ui.mouse, {
},
_mouseStart: function(event) {
- var that = this;
+ var that = this,
+ options = this.options;
this.opos = [event.pageX, event.pageY];
- if (this.options.disabled)
+ if (this.options.disabled) {
return;
-
- var options = this.options;
+ }
this.selectees = $(options.filter, this.element[0]);
@@ -114,9 +114,10 @@ $.widget("ui.selectable", $.ui.mouse, {
});
$(event.target).parents().andSelf().each(function() {
- var selectee = $.data(this, "selectable-item");
+ var doSelect,
+ selectee = $.data(this, "selectable-item");
if (selectee) {
- var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');
+ doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');
selectee.$element
.removeClass(doSelect ? "ui-unselecting" : "ui-selected")
.addClass(doSelect ? "ui-selecting" : "ui-unselecting");
@@ -140,28 +141,37 @@ $.widget("ui.selectable", $.ui.mouse, {
},
_mouseDrag: function(event) {
- var that = this;
+
this.dragged = true;
- if (this.options.disabled)
+ if (this.options.disabled) {
return;
+ }
- var options = this.options;
+ var tmp,
+ that = this,
+ options = this.options,
+ x1 = this.opos[0],
+ y1 = this.opos[1],
+ x2 = event.pageX,
+ y2 = event.pageY;
- var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
- if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
- if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
+ if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; }
+ if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; }
this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
this.selectees.each(function() {
- var selectee = $.data(this, "selectable-item");
+ var selectee = $.data(this, "selectable-item"),
+ hit = false;
+
//prevent helper from being selected if appendTo: selectable
- if (!selectee || selectee.element == that.element[0])
+ if (!selectee || selectee.element === that.element[0]) {
return;
- var hit = false;
- if (options.tolerance == 'touch') {
+ }
+
+ if (options.tolerance === 'touch') {
hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
- } else if (options.tolerance == 'fit') {
+ } else if (options.tolerance === 'fit') {
hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
}
@@ -228,8 +238,6 @@ $.widget("ui.selectable", $.ui.mouse, {
this.dragged = false;
- var options = this.options;
-
$('.ui-unselecting', this.element[0]).each(function() {
var selectee = $.data(this, "selectable-item");
selectee.$element.removeClass('ui-unselecting');
diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js
index f24982878..18f7113d4 100644
--- a/ui/jquery.ui.slider.js
+++ b/ui/jquery.ui.slider.js
@@ -36,11 +36,10 @@ $.widget( "ui.slider", $.ui.mouse, {
},
_create: function() {
- var i,
+ var i, handleCount,
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;
@@ -79,6 +78,8 @@ $.widget( "ui.slider", $.ui.mouse, {
( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) );
}
+ handleCount = ( o.values && o.values.length ) || 1;
+
for ( i = existingHandles.length; i < handleCount; i++ ) {
handles.push( handle );
}
@@ -277,7 +278,7 @@ $.widget( "ui.slider", $.ui.mouse, {
return true;
},
- _mouseStart: function( event ) {
+ _mouseStart: function() {
return true;
},
@@ -509,6 +510,12 @@ $.widget( "ui.slider", $.ui.mouse, {
}
this._animateOff = false;
break;
+ case "min":
+ case "max":
+ this._animateOff = true;
+ this._refreshValue();
+ this._animateOff = false;
+ break;
}
},
@@ -584,7 +591,7 @@ $.widget( "ui.slider", $.ui.mouse, {
_set = {};
if ( this.options.values && this.options.values.length ) {
- this.handles.each(function( i, j ) {
+ this.handles.each(function( i ) {
valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js
index a2132a9bd..a98e46632 100644
--- a/ui/jquery.ui.sortable.js
+++ b/ui/jquery.ui.sortable.js
@@ -15,6 +15,7 @@
*/
(function( $, undefined ) {
+/*jshint onevar: false, curly: false, eqeqeq: false, laxbreak: true, shadow: true, loopfunc: true */
$.widget("ui.sortable", $.ui.mouse, {
version: "@VERSION",
widgetEventPrefix: "sort",
@@ -62,7 +63,7 @@ $.widget("ui.sortable", $.ui.mouse, {
this._mouseInit();
//We're ready to go
- this.ready = true
+ this.ready = true;
},
@@ -101,7 +102,9 @@ $.widget("ui.sortable", $.ui.mouse, {
this._refreshItems(event);
//Find out if the clicked node (or one of its parents) is a actual item in this.items
- var currentItem = null, nodes = $(event.target).parents().each(function() {
+ var currentItem = null;
+
+ $(event.target).parents().each(function() {
if($.data(this, that.widgetName + '-item') == that) {
currentItem = $(this);
return false;
@@ -221,7 +224,7 @@ $.widget("ui.sortable", $.ui.mouse, {
//Post 'activate' events to possible containers
if(!noActivation) {
- for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, this._uiHash(this)); }
+ for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, this._uiHash(this)); }
}
//Prepare possible droppables
@@ -418,7 +421,7 @@ $.widget("ui.sortable", $.ui.mouse, {
var str = []; o = o || {};
$(items).each(function() {
- var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
+ var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[\-=_](.+)/));
if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
});
@@ -458,7 +461,7 @@ $.widget("ui.sortable", $.ui.mouse, {
var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
- if( this.options.tolerance == "pointer"
+ if (this.options.tolerance == "pointer"
|| this.options.forcePointerForContainers
|| (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])
) {
@@ -507,12 +510,12 @@ $.widget("ui.sortable", $.ui.mouse, {
_getDragVerticalDirection: function() {
var delta = this.positionAbs.top - this.lastPositionAbs.top;
- return delta != 0 && (delta > 0 ? "down" : "up");
+ return delta !== 0 && (delta > 0 ? "down" : "up");
},
_getDragHorizontalDirection: function() {
var delta = this.positionAbs.left - this.lastPositionAbs.left;
- return delta != 0 && (delta > 0 ? "right" : "left");
+ return delta !== 0 && (delta > 0 ? "right" : "left");
},
refresh: function(event) {
@@ -538,12 +541,12 @@ $.widget("ui.sortable", $.ui.mouse, {
for (var i = connectWith.length - 1; i >= 0; i--){
var cur = $(connectWith[i]);
for (var j = cur.length - 1; j >= 0; j--){
- var inst = $.data(cur[j], this.widgetName);
+ var inst = $.data(cur[j], this.widgetFullName);
if(inst && inst != this && !inst.options.disabled) {
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
}
- };
- };
+ }
+ }
}
queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
@@ -552,7 +555,7 @@ $.widget("ui.sortable", $.ui.mouse, {
queries[i][0].each(function() {
items.push(this);
});
- };
+ }
return $(items);
@@ -566,7 +569,7 @@ $.widget("ui.sortable", $.ui.mouse, {
for (var j=0; j < list.length; j++) {
if(list[j] == item.item[0])
return false;
- };
+ }
return true;
});
@@ -584,13 +587,13 @@ $.widget("ui.sortable", $.ui.mouse, {
for (var i = connectWith.length - 1; i >= 0; i--){
var cur = $(connectWith[i]);
for (var j = cur.length - 1; j >= 0; j--){
- var inst = $.data(cur[j], this.widgetName);
+ var inst = $.data(cur[j], this.widgetFullName);
if(inst && inst != this && !inst.options.disabled) {
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
this.containers.push(inst);
}
- };
- };
+ }
+ }
}
for (var i = queries.length - 1; i >= 0; i--) {
@@ -608,8 +611,8 @@ $.widget("ui.sortable", $.ui.mouse, {
width: 0, height: 0,
left: 0, top: 0
});
- };
- };
+ }
+ }
},
@@ -637,7 +640,7 @@ $.widget("ui.sortable", $.ui.mouse, {
var p = t.offset();
item.left = p.left;
item.top = p.top;
- };
+ }
if(this.options.custom && this.options.custom.refreshContainers) {
this.options.custom.refreshContainers.call(this);
@@ -648,7 +651,7 @@ $.widget("ui.sortable", $.ui.mouse, {
this.containers[i].containerCache.top = p.top;
this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
- };
+ }
}
return this;
@@ -679,8 +682,8 @@ $.widget("ui.sortable", $.ui.mouse, {
if(className && !o.forcePlaceholderSize) return;
//If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
- if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css('paddingTop')||0, 10) - parseInt(that.currentItem.css('paddingBottom')||0, 10)); };
- if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css('paddingLeft')||0, 10) - parseInt(that.currentItem.css('paddingRight')||0, 10)); };
+ if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css('paddingTop')||0, 10) - parseInt(that.currentItem.css('paddingBottom')||0, 10)); }
+ if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css('paddingLeft')||0, 10) - parseInt(that.currentItem.css('paddingRight')||0, 10)); }
}
};
}
@@ -786,8 +789,8 @@ $.widget("ui.sortable", $.ui.mouse, {
if(helper[0] == this.currentItem[0])
this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
- if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
- if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());
+ if(!helper[0].style.width || o.forceHelperSize) helper.width(this.currentItem.width());
+ if(!helper[0].style.height || o.forceHelperSize) helper.height(this.currentItem.height());
return helper;
@@ -899,7 +902,7 @@ $.widget("ui.sortable", $.ui.mouse, {
if(!pos) pos = this.position;
var mod = d == "absolute" ? 1 : -1;
- var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+ var scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
return {
top: (
@@ -949,10 +952,10 @@ $.widget("ui.sortable", $.ui.mouse, {
if(o.grid) {
var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
- pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+ pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
- pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+ pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
}
}
@@ -1047,7 +1050,9 @@ $.widget("ui.sortable", $.ui.mouse, {
if(this.cancelHelperRemoval) {
if(!noPropagation) {
this._trigger("beforeStop", event, this._uiHash());
- for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
+ for (var i=0; i < delayedTriggers.length; i++) {
+ delayedTriggers[i].call(this, event);
+ } //Trigger all delayed events
this._trigger("stop", event, this._uiHash());
}
@@ -1063,7 +1068,9 @@ $.widget("ui.sortable", $.ui.mouse, {
if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;
if(!noPropagation) {
- for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
+ for (var i=0; i < delayedTriggers.length; i++) {
+ delayedTriggers[i].call(this, event);
+ } //Trigger all delayed events
this._trigger("stop", event, this._uiHash());
}
diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js
index 23cce18ef..406eefb91 100644
--- a/ui/jquery.ui.spinner.js
+++ b/ui/jquery.ui.spinner.js
@@ -94,7 +94,6 @@ $.widget( "ui.spinner", {
},
keyup: "_stop",
focus: function() {
- this.uiSpinner.addClass( "ui-state-active" );
this.previous = this.element.val();
},
blur: function( event ) {
@@ -104,7 +103,6 @@ $.widget( "ui.spinner", {
}
this._refresh();
- this.uiSpinner.removeClass( "ui-state-active" );
if ( this.previous !== this.element.val() ) {
this._trigger( "change", event );
}
@@ -196,7 +194,6 @@ $.widget( "ui.spinner", {
.parent()
// add buttons
.append( this._buttonHtml() );
- this._hoverable( uiSpinner );
this.element.attr( "role", "spinbutton" );
@@ -242,7 +239,7 @@ $.widget( "ui.spinner", {
},
_uiSpinnerHtml: function() {
- return "<span class='ui-spinner ui-state-default ui-widget ui-widget-content ui-corner-all'></span>";
+ return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>";
},
_buttonHtml: function() {
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js
index 7d38fb46e..5b5227128 100644
--- a/ui/jquery.ui.tabs.js
+++ b/ui/jquery.ui.tabs.js
@@ -22,11 +22,13 @@ function getNextTabId() {
}
function isLocal( 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, "" );
+ anchor.href.replace( rhash, "" ) ===
+ location.href.replace( rhash, "" )
+ // support: Safari 5.1
+ // Safari 5.1 doesn't encode spaces in window.location
+ // but it does encode spaces from anchors (#8777)
+ .replace( /\s/g, "%20" );
}
$.widget( "ui.tabs", {
@@ -48,8 +50,7 @@ $.widget( "ui.tabs", {
},
_create: function() {
- var panel,
- that = this,
+ var that = this,
options = this.options,
active = options.active,
locationHash = location.hash.substring( 1 );
@@ -298,8 +299,7 @@ $.widget( "ui.tabs", {
},
refresh: function() {
- var next,
- options = this.options,
+ var options = this.options,
lis = this.tablist.children( ":has(a[href])" );
// get disabled tabs from class attribute from HTML
@@ -492,18 +492,10 @@ $.widget( "ui.tabs", {
},
_setupHeightStyle: function( heightStyle ) {
- var maxHeight, overflow,
+ var maxHeight,
parent = this.element.parent();
if ( heightStyle === "fill" ) {
- // IE 6 treats height like minHeight, so we need to turn off overflow
- // in order to get a reliable height
- // we use the minHeight support test because we assume that only
- // browsers that don't support minHeight will treat height as minHeight
- if ( !$.support.minHeight ) {
- overflow = parent.css( "overflow" );
- parent.css( "overflow", "hidden");
- }
maxHeight = parent.height();
this.element.siblings( ":visible" ).each(function() {
var elem = $( this ),
@@ -514,9 +506,6 @@ $.widget( "ui.tabs", {
}
maxHeight -= elem.outerHeight( true );
});
- if ( overflow ) {
- parent.css( "overflow", overflow );
- }
this.element.children().not( this.panels ).each(function() {
maxHeight -= $( this ).outerHeight( true );
@@ -727,6 +716,8 @@ $.widget( "ui.tabs", {
}
});
+ this.panels.show();
+
if ( this.options.heightStyle !== "content" ) {
this.panels.css( "height", "" );
}
@@ -830,7 +821,6 @@ $.widget( "ui.tabs", {
}
},
- // TODO: Remove this function in 1.10 when ajaxOptions is removed
_ajaxSettings: function( anchor, event, eventData ) {
var that = this;
return {
@@ -848,512 +838,4 @@ $.widget( "ui.tabs", {
}
});
-// DEPRECATED
-if ( $.uiBackCompat !== false ) {
-
- // helper method for a lot of the back compat extensions
- $.ui.tabs.prototype._ui = function( tab, panel ) {
- return {
- tab: tab,
- panel: panel,
- index: this.anchors.index( tab )
- };
- };
-
- // url method
- $.widget( "ui.tabs", $.ui.tabs, {
- url: function( index, url ) {
- this.anchors.eq( index ).attr( "href", url );
- }
- });
-
- // TODO: Remove _ajaxSettings() method when removing this extension
- // ajaxOptions and cache options
- $.widget( "ui.tabs", $.ui.tabs, {
- options: {
- ajaxOptions: null,
- cache: false
- },
-
- _create: function() {
- this._super();
-
- var that = this;
-
- this._on({ tabsbeforeload: function( event, ui ) {
- // tab is already cached
- if ( $.data( ui.tab[ 0 ], "cache.tabs" ) ) {
- event.preventDefault();
- return;
- }
-
- ui.jqXHR.success(function() {
- if ( that.options.cache ) {
- $.data( ui.tab[ 0 ], "cache.tabs", true );
- }
- });
- }});
- },
-
- _ajaxSettings: function( anchor, event, ui ) {
- var ajaxOptions = this.options.ajaxOptions;
- return $.extend( {}, ajaxOptions, {
- error: function( xhr, s, e ) {
- try {
- // Passing index avoid a race condition when this method is
- // called after the user has selected another tab.
- // Pass the anchor that initiated this request allows
- // loadError to manipulate the tab content panel via $(a.hash)
- ajaxOptions.error(
- xhr, s, ui.tab.closest( "li" ).index(), ui.tab[ 0 ] );
- }
- catch ( e ) {}
- }
- }, this._superApply( arguments ) );
- },
-
- _setOption: function( key, value ) {
- // reset cache if switching from cached to not cached
- if ( key === "cache" && value === false ) {
- this.anchors.removeData( "cache.tabs" );
- }
- this._super( key, value );
- },
-
- _destroy: function() {
- this.anchors.removeData( "cache.tabs" );
- this._super();
- },
-
- url: function( index, url ){
- this.anchors.eq( index ).removeData( "cache.tabs" );
- this._superApply( arguments );
- }
- });
-
- // abort method
- $.widget( "ui.tabs", $.ui.tabs, {
- abort: function() {
- if ( this.xhr ) {
- this.xhr.abort();
- }
- }
- });
-
- // spinner
- $.widget( "ui.tabs", $.ui.tabs, {
- options: {
- spinner: "<em>Loading&#8230;</em>"
- },
- _create: function() {
- this._super();
- this._on({
- tabsbeforeload: function( event, ui ) {
- // Don't react to nested tabs or tabs that don't use a spinner
- if ( event.target !== this.element[ 0 ] ||
- !this.options.spinner ) {
- return;
- }
-
- var span = ui.tab.find( "span" ),
- html = span.html();
- span.html( this.options.spinner );
- ui.jqXHR.complete(function() {
- span.html( html );
- });
- }
- });
- }
- });
-
- // enable/disable events
- $.widget( "ui.tabs", $.ui.tabs, {
- options: {
- enable: null,
- disable: null
- },
-
- enable: function( index ) {
- var options = this.options,
- trigger;
-
- if ( index && options.disabled === true ||
- ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) !== -1 ) ) {
- trigger = true;
- }
-
- this._superApply( arguments );
-
- if ( trigger ) {
- this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
- }
- },
-
- disable: function( index ) {
- var options = this.options,
- trigger;
-
- if ( index && options.disabled === false ||
- ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) === -1 ) ) {
- trigger = true;
- }
-
- this._superApply( arguments );
-
- if ( trigger ) {
- this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
- }
- }
- });
-
- // add/remove methods and events
- $.widget( "ui.tabs", $.ui.tabs, {
- options: {
- add: null,
- remove: null,
- tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
- },
-
- add: function( url, label, index ) {
- if ( index === undefined ) {
- index = this.anchors.length;
- }
-
- var doInsertAfter, panel,
- options = this.options,
- li = $( options.tabTemplate
- .replace( /#\{href\}/g, url )
- .replace( /#\{label\}/g, label ) ),
- id = !url.indexOf( "#" ) ?
- url.replace( "#", "" ) :
- this._tabId( li );
-
- li.addClass( "ui-state-default ui-corner-top" ).data( "ui-tabs-destroy", true );
- li.attr( "aria-controls", id );
-
- doInsertAfter = index >= this.tabs.length;
-
- // try to find an existing element before creating a new one
- panel = this.element.find( "#" + id );
- if ( !panel.length ) {
- panel = this._createPanel( id );
- if ( doInsertAfter ) {
- if ( index > 0 ) {
- panel.insertAfter( this.panels.eq( -1 ) );
- } else {
- panel.appendTo( this.element );
- }
- } else {
- panel.insertBefore( this.panels[ index ] );
- }
- }
- panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ).hide();
-
- if ( doInsertAfter ) {
- li.appendTo( this.tablist );
- } else {
- li.insertBefore( this.tabs[ index ] );
- }
-
- options.disabled = $.map( options.disabled, function( n ) {
- return n >= index ? ++n : n;
- });
-
- this.refresh();
- if ( this.tabs.length === 1 && options.active === false ) {
- this.option( "active", 0 );
- }
-
- this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
- return this;
- },
-
- remove: function( index ) {
- index = this._getIndex( index );
- var options = this.options,
- tab = this.tabs.eq( index ).remove(),
- panel = this._getPanelForTab( tab ).remove();
-
- // If selected tab was removed focus tab to the right or
- // in case the last tab was removed the tab to the left.
- // We check for more than 2 tabs, because if there are only 2,
- // then when we remove this tab, there will only be one tab left
- // so we don't need to detect which tab to activate.
- if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 2 ) {
- this._activate( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
- }
-
- options.disabled = $.map(
- $.grep( options.disabled, function( n ) {
- return n !== index;
- }),
- function( n ) {
- return n >= index ? --n : n;
- });
-
- this.refresh();
-
- this._trigger( "remove", null, this._ui( tab.find( "a" )[ 0 ], panel[ 0 ] ) );
- return this;
- }
- });
-
- // length method
- $.widget( "ui.tabs", $.ui.tabs, {
- length: function() {
- return this.anchors.length;
- }
- });
-
- // panel ids (idPrefix option + title attribute)
- $.widget( "ui.tabs", $.ui.tabs, {
- options: {
- idPrefix: "ui-tabs-"
- },
-
- _tabId: function( tab ) {
- var a = tab.is( "li" ) ? tab.find( "a[href]" ) : tab;
- a = a[0];
- return $( a ).closest( "li" ).attr( "aria-controls" ) ||
- a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF\-]/g, "" ) ||
- this.options.idPrefix + getNextTabId();
- }
- });
-
- // _createPanel method
- $.widget( "ui.tabs", $.ui.tabs, {
- options: {
- panelTemplate: "<div></div>"
- },
-
- _createPanel: function( id ) {
- return $( this.options.panelTemplate )
- .attr( "id", id )
- .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
- .data( "ui-tabs-destroy", true );
- }
- });
-
- // selected option
- $.widget( "ui.tabs", $.ui.tabs, {
- _create: function() {
- var options = this.options;
- if ( options.active === null && options.selected !== undefined ) {
- options.active = options.selected === -1 ? false : options.selected;
- }
- this._super();
- options.selected = options.active;
- if ( options.selected === false ) {
- options.selected = -1;
- }
- },
-
- _setOption: function( key, value ) {
- if ( key !== "selected" ) {
- return this._super( key, value );
- }
-
- var options = this.options;
- this._super( "active", value === -1 ? false : value );
- options.selected = options.active;
- if ( options.selected === false ) {
- options.selected = -1;
- }
- },
-
- _eventHandler: function( event ) {
- this._superApply( arguments );
- this.options.selected = this.options.active;
- if ( this.options.selected === false ) {
- this.options.selected = -1;
- }
- }
- });
-
- // show and select event
- $.widget( "ui.tabs", $.ui.tabs, {
- options: {
- show: null,
- select: null
- },
- _create: function() {
- this._super();
- if ( this.options.active !== false ) {
- this._trigger( "show", null, this._ui(
- this.active.find( ".ui-tabs-anchor" )[ 0 ],
- this._getPanelForTab( this.active )[ 0 ] ) );
- }
- },
- _trigger: function( type, event, data ) {
- var ret = this._superApply( arguments );
- if ( !ret ) {
- return false;
- }
- if ( type === "beforeActivate" && data.newTab.length ) {
- ret = this._super( "select", event, {
- tab: data.newTab.find( ".ui-tabs-anchor" )[ 0],
- panel: data.newPanel[ 0 ],
- index: data.newTab.closest( "li" ).index()
- });
- } else if ( type === "activate" && data.newTab.length ) {
- ret = this._super( "show", event, {
- tab: data.newTab.find( ".ui-tabs-anchor" )[ 0 ],
- panel: data.newPanel[ 0 ],
- index: data.newTab.closest( "li" ).index()
- });
- }
- return ret;
- }
- });
-
- // select method
- $.widget( "ui.tabs", $.ui.tabs, {
- select: function( index ) {
- index = this._getIndex( index );
- if ( index === -1 ) {
- if ( this.options.collapsible && this.options.selected !== -1 ) {
- index = this.options.selected;
- } else {
- return;
- }
- }
- this.anchors.eq( index ).trigger( this.options.event + this.eventNamespace );
- }
- });
-
- // cookie option
- (function() {
-
- var listId = 0;
-
- $.widget( "ui.tabs", $.ui.tabs, {
- options: {
- cookie: null // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
- },
- _create: function() {
- var options = this.options,
- active;
- if ( options.active == null && options.cookie ) {
- active = parseInt( this._cookie(), 10 );
- if ( active === -1 ) {
- active = false;
- }
- options.active = active;
- }
- this._super();
- },
- _cookie: function( active ) {
- var cookie = [ this.cookie ||
- ( this.cookie = this.options.cookie.name || "ui-tabs-" + (++listId) ) ];
- if ( arguments.length ) {
- cookie.push( active === false ? -1 : active );
- cookie.push( this.options.cookie );
- }
- return $.cookie.apply( null, cookie );
- },
- _refresh: function() {
- this._super();
- if ( this.options.cookie ) {
- this._cookie( this.options.active, this.options.cookie );
- }
- },
- _eventHandler: function( event ) {
- this._superApply( arguments );
- if ( this.options.cookie ) {
- this._cookie( this.options.active, this.options.cookie );
- }
- },
- _destroy: function() {
- this._super();
- if ( this.options.cookie ) {
- this._cookie( null, this.options.cookie );
- }
- }
- });
-
- })();
-
- // load event
- $.widget( "ui.tabs", $.ui.tabs, {
- _trigger: function( type, event, data ) {
- var _data = $.extend( {}, data );
- if ( type === "load" ) {
- _data.panel = _data.panel[ 0 ];
- _data.tab = _data.tab.find( ".ui-tabs-anchor" )[ 0 ];
- }
- return this._super( type, event, _data );
- }
- });
-
- // fx option
- // The new animation options (show, hide) conflict with the old show callback.
- // The old fx option wins over show/hide anyway (always favor back-compat).
- // If a user wants to use the new animation API, they must give up the old API.
- $.widget( "ui.tabs", $.ui.tabs, {
- options: {
- fx: null // e.g. { height: "toggle", opacity: "toggle", duration: 200 }
- },
-
- _getFx: function() {
- var hide, show,
- fx = this.options.fx;
-
- if ( fx ) {
- if ( $.isArray( fx ) ) {
- hide = fx[ 0 ];
- show = fx[ 1 ];
- } else {
- hide = show = fx;
- }
- }
-
- return fx ? { show: show, hide: hide } : null;
- },
-
- _toggle: function( event, eventData ) {
- var that = this,
- toShow = eventData.newPanel,
- toHide = eventData.oldPanel,
- fx = this._getFx();
-
- if ( !fx ) {
- return this._super( event, eventData );
- }
-
- that.running = true;
-
- function complete() {
- that.running = false;
- that._trigger( "activate", event, eventData );
- }
-
- function show() {
- eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
-
- if ( toShow.length && fx.show ) {
- toShow
- .animate( fx.show, fx.show.duration, function() {
- complete();
- });
- } else {
- toShow.show();
- complete();
- }
- }
-
- // start out by hiding, then showing, then completing
- if ( toHide.length && fx.hide ) {
- toHide.animate( fx.hide, fx.hide.duration, function() {
- eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
- show();
- });
- } else {
- eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
- toHide.hide();
- show();
- }
- }
- });
-}
-
})( jQuery );
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js
index 980b43868..e5b496bee 100644
--- a/ui/jquery.ui.tooltip.js
+++ b/ui/jquery.ui.tooltip.js
@@ -49,11 +49,12 @@ $.widget( "ui.tooltip", {
return $( this ).attr( "title" );
},
hide: true,
- items: "[title]",
+ // Disabled elements have inconsistent behavior across browsers (#8661)
+ items: "[title]:not([disabled])",
position: {
- my: "left+15 center",
- at: "right center",
- collision: "flipfit flipfit"
+ my: "left top+15",
+ at: "left bottom",
+ collision: "flipfit flip"
},
show: true,
tooltipClass: null,
@@ -72,6 +73,12 @@ $.widget( "ui.tooltip", {
// IDs of generated tooltips, needed for destroy
this.tooltips = {};
+ // IDs of parent tooltips where we removed the title attribute
+ this.parents = {};
+
+ if ( this.options.disabled ) {
+ this._disable();
+ }
},
_setOption: function( key, value ) {
@@ -125,7 +132,10 @@ $.widget( "ui.tooltip", {
},
open: function( event ) {
- var target = $( event ? event.target : this.element )
+ var that = this,
+ target = $( event ? event.target : this.element )
+ // we need closest here due to mouseover bubbling,
+ // but always pointing at the same event target
.closest( this.options.items );
// No element to show a tooltip for
@@ -149,7 +159,28 @@ $.widget( "ui.tooltip", {
target.data( "ui-tooltip-title", target.attr( "title" ) );
}
- target.data( "tooltip-open", true );
+ target.data( "ui-tooltip-open", true );
+
+ // kill parent tooltips, custom or native, for hover
+ if ( event && event.type === "mouseover" ) {
+ target.parents().each(function() {
+ var parent = $( this ),
+ blurEvent;
+ if ( parent.data( "ui-tooltip-open" ) ) {
+ blurEvent = $.Event( "blur" );
+ blurEvent.target = blurEvent.currentTarget = this;
+ that.close( blurEvent, true );
+ }
+ if ( parent.attr( "title" ) ) {
+ parent.uniqueId();
+ that.parents[ this.id ] = {
+ element: this,
+ title: parent.attr( "title" )
+ };
+ parent.attr( "title", "" );
+ }
+ });
+ }
this._updateContent( target, event );
},
@@ -165,7 +196,7 @@ $.widget( "ui.tooltip", {
content = contentOption.call( target[0], function( response ) {
// ignore async response if tooltip was closed already
- if ( !target.data( "tooltip-open" ) ) {
+ if ( !target.data( "ui-tooltip-open" ) ) {
return;
}
// IE may instantly serve a cached response for ajax requests
@@ -180,7 +211,9 @@ $.widget( "ui.tooltip", {
},
_open: function( event, target, content ) {
- var tooltip, positionOption;
+ var tooltip, events, delayedShow,
+ positionOption = $.extend( {}, this.options.position );
+
if ( !content ) {
return;
}
@@ -214,10 +247,12 @@ $.widget( "ui.tooltip", {
function position( event ) {
positionOption.of = event;
+ if ( tooltip.is( ":hidden" ) ) {
+ return;
+ }
tooltip.position( positionOption );
}
- if ( this.options.track && event && /^mouse/.test( event.originalEvent.type ) ) {
- positionOption = $.extend( {}, this.options.position );
+ if ( this.options.track && event && /^mouse/.test( event.type ) ) {
this._on( this.document, {
mousemove: position
});
@@ -232,23 +267,42 @@ $.widget( "ui.tooltip", {
tooltip.hide();
this._show( tooltip, this.options.show );
+ // Handle tracking tooltips that are shown with a delay (#8644). As soon
+ // as the tooltip is visible, position the tooltip using the most recent
+ // event.
+ if ( this.options.show && this.options.show.delay ) {
+ delayedShow = setInterval(function() {
+ if ( tooltip.is( ":visible" ) ) {
+ position( positionOption.of );
+ clearInterval( delayedShow );
+ }
+ }, $.fx.interval );
+ }
this._trigger( "open", event, { tooltip: tooltip } );
- this._on( target, {
- mouseleave: "close",
- focusout: "close",
+ events = {
keyup: function( event ) {
if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
var fakeEvent = $.Event(event);
fakeEvent.currentTarget = target[0];
this.close( fakeEvent, true );
}
+ },
+ remove: function() {
+ this._removeTooltip( tooltip );
}
- });
+ };
+ if ( !event || event.type === "mouseover" ) {
+ events.mouseleave = "close";
+ }
+ if ( !event || event.type === "focusin" ) {
+ events.focusout = "close";
+ }
+ this._on( true, target, events );
},
- close: function( event, force ) {
+ close: function( event ) {
var that = this,
target = $( event ? event.currentTarget : this.element ),
tooltip = this._find( target );
@@ -259,16 +313,6 @@ $.widget( "ui.tooltip", {
return;
}
- // don't close if the element has focus
- // this prevents the tooltip from closing if you hover while focused
- //
- // we have to check the event type because tabbing out of the document
- // may leave the element as the activeElement
- if ( !force && event && event.type !== "focusout" &&
- this.document[0].activeElement === target[0] ) {
- return;
- }
-
// only set title if we had one before (see comment in _open())
if ( target.data( "ui-tooltip-title" ) ) {
target.attr( "title", target.data( "ui-tooltip-title" ) );
@@ -278,14 +322,24 @@ $.widget( "ui.tooltip", {
tooltip.stop( true );
this._hide( tooltip, this.options.hide, function() {
- $( this ).remove();
- delete that.tooltips[ this.id ];
+ that._removeTooltip( $( this ) );
});
- target.removeData( "tooltip-open" );
+ target.removeData( "ui-tooltip-open" );
this._off( target, "mouseleave focusout keyup" );
+ // Remove 'remove' binding only on delegated targets
+ if ( target[0] !== this.element[0] ) {
+ this._off( target, "remove" );
+ }
this._off( this.document, "mousemove" );
+ if ( event && event.type === "mouseleave" ) {
+ $.each( this.parents, function( id, parent ) {
+ $( parent.element ).attr( "title", parent.title );
+ delete that.parents[ id ];
+ });
+ }
+
this.closing = true;
this._trigger( "close", event, { tooltip: tooltip } );
this.closing = false;
@@ -304,9 +358,6 @@ $.widget( "ui.tooltip", {
.addClass( "ui-tooltip-content" )
.appendTo( tooltip );
tooltip.appendTo( this.document[0].body );
- if ( $.fn.bgiframe ) {
- tooltip.bgiframe();
- }
this.tooltips[ id ] = element;
return tooltip;
},
@@ -316,6 +367,11 @@ $.widget( "ui.tooltip", {
return id ? $( "#" + id ) : $();
},
+ _removeTooltip: function( tooltip ) {
+ tooltip.remove();
+ delete this.tooltips[ tooltip.attr( "id" ) ];
+ },
+
_destroy: function() {
var that = this;
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index a125dd5ac..06f25576a 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -101,13 +101,11 @@ $.widget = function( name, base, prototype ) {
// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
- widgetEventPrefix: name
+ widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
}, prototype, {
constructor: constructor,
namespace: namespace,
widgetName: name,
- // TODO remove widgetBaseClass, see #8155
- widgetBaseClass: fullName,
widgetFullName: fullName
});
@@ -142,8 +140,17 @@ $.widget.extend = function( target ) {
for ( ; inputIndex < inputLength; inputIndex++ ) {
for ( key in input[ inputIndex ] ) {
value = input[ inputIndex ][ key ];
- if (input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
- target[ key ] = $.isPlainObject( value ) ? $.widget.extend( {}, target[ key ], value ) : value;
+ if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
+ // Clone objects
+ if ( $.isPlainObject( value ) ) {
+ target[ key ] = $.isPlainObject( target[ key ] ) ?
+ $.widget.extend( {}, target[ key ], value ) :
+ // Don't extend strings, arrays, etc. with objects
+ $.widget.extend( {}, value );
+ // Copy everything else by reference
+ } else {
+ target[ key ] = value;
+ }
}
}
}
@@ -151,7 +158,7 @@ $.widget.extend = function( target ) {
};
$.widget.bridge = function( name, object ) {
- var fullName = object.prototype.widgetFullName;
+ var fullName = object.prototype.widgetFullName || name;
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string",
args = slice.call( arguments, 1 ),
@@ -187,7 +194,7 @@ $.widget.bridge = function( name, object ) {
if ( instance ) {
instance.option( options || {} )._init();
} else {
- new object( options, this );
+ $.data( this, fullName, new object( options, this ) );
}
});
}
@@ -196,7 +203,7 @@ $.widget.bridge = function( name, object ) {
};
};
-$.Widget = function( options, element ) {};
+$.Widget = function( /* options, element */ ) {};
$.Widget._childConstructors = [];
$.Widget.prototype = {
@@ -224,11 +231,14 @@ $.Widget.prototype = {
this.focusable = $();
if ( element !== this ) {
- // 1.9 BC for #7810
- // TODO remove dual storage
- $.data( element, this.widgetName, this );
$.data( element, this.widgetFullName, this );
- this._on({ remove: "destroy" });
+ this._on( true, this.element, {
+ remove: function( event ) {
+ if ( event.target === element ) {
+ this.destroy();
+ }
+ }
+ });
this.document = $( element.style ?
// element within the document
element.ownerDocument :
@@ -346,25 +356,36 @@ $.Widget.prototype = {
return this._setOption( "disabled", true );
},
- _on: function( element, handlers ) {
+ _on: function( suppressDisabledCheck, element, handlers ) {
+ var delegateElement,
+ instance = this;
+
+ // no suppressDisabledCheck flag, shuffle arguments
+ if ( typeof suppressDisabledCheck !== "boolean" ) {
+ handlers = element;
+ element = suppressDisabledCheck;
+ suppressDisabledCheck = false;
+ }
+
// no element argument, shuffle and use this.element
if ( !handlers ) {
handlers = element;
element = this.element;
+ delegateElement = this.widget();
} else {
// accept selectors, DOM elements
- element = $( element );
+ element = delegateElement = $( element );
this.bindings = this.bindings.add( element );
}
- var instance = this;
$.each( handlers, function( event, handler ) {
function handlerProxy() {
// allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
- if ( instance.options.disabled === true ||
- $( this ).hasClass( "ui-state-disabled" ) ) {
+ if ( !suppressDisabledCheck &&
+ ( instance.options.disabled === true ||
+ $( this ).hasClass( "ui-state-disabled" ) ) ) {
return;
}
return ( typeof handler === "string" ? instance[ handler ] : handler )
@@ -381,7 +402,7 @@ $.Widget.prototype = {
eventName = match[1] + instance.eventNamespace,
selector = match[2];
if ( selector ) {
- instance.widget().delegate( selector, eventName, handlerProxy );
+ delegateElement.delegate( selector, eventName, handlerProxy );
} else {
element.bind( eventName, handlerProxy );
}
@@ -476,7 +497,7 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
if ( options.delay ) {
element.delay( options.delay );
}
- if ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) {
+ if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
element[ method ]( options );
} else if ( effectName !== method && element[ effectName ] ) {
element[ effectName ]( options.duration, options.easing, callback );
@@ -492,11 +513,4 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
};
});
-// DEPRECATED
-if ( $.uiBackCompat !== false ) {
- $.Widget.prototype._getCreateOptions = function() {
- return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
- };
-}
-
})( jQuery );