aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2015-10-08 15:06:55 +0200
committerFelix Nagel <info@felixnagel.com>2015-10-08 15:06:55 +0200
commit2fe43bbbe20ba59dbbbef1effd9f59ac64cb15a7 (patch)
tree223ec5d743a1c0fbfc18127b7a6bc75c435c72be /ui
parent7e8b7234b214f9ee363f4f85ad4a24c4a269baba (diff)
downloadjquery-ui-2fe43bbbe20ba59dbbbef1effd9f59ac64cb15a7.tar.gz
jquery-ui-2fe43bbbe20ba59dbbbef1effd9f59ac64cb15a7.zip
Calendar: Fix jscs errors after merging master
Diffstat (limited to 'ui')
-rw-r--r--ui/date.js1
-rw-r--r--ui/widgets/calendar.js12
-rw-r--r--ui/widgets/datepicker.js31
3 files changed, 24 insertions, 20 deletions
diff --git a/ui/date.js b/ui/date.js
index ba9203873..2d94f1083 100644
--- a/ui/date.js
+++ b/ui/date.js
@@ -59,6 +59,7 @@ $.extend( $.ui.date.prototype, {
setDay: function( day ) {
var date = this.dateObject;
+
// FIXME: Why not to use .setDate?
this.dateObject = new Date( date.getFullYear(), date.getMonth(), day, date.getHours(),
date.getMinutes(), date.getSeconds() );
diff --git a/ui/widgets/calendar.js b/ui/widgets/calendar.js
index 1cdb07fdb..cb777ef01 100644
--- a/ui/widgets/calendar.js
+++ b/ui/widgets/calendar.js
@@ -195,8 +195,8 @@ return $.widget( "ui.calendar", {
_setLocale: function( locale, dateFormat ) {
var globalize = new Globalize( locale ),
- weekdayShortFormatter = globalize.dateFormatter({ raw: "EEEEEE" }),
- weekdayNarrowFormatter = globalize.dateFormatter({ raw: "EEEEE" });
+ weekdayShortFormatter = globalize.dateFormatter( { raw: "EEEEEE" } ),
+ weekdayNarrowFormatter = globalize.dateFormatter( { raw: "EEEEE" } );
this._format = globalize.dateFormatter( dateFormat );
this._parse = globalize.dateParser( dateFormat );
@@ -209,9 +209,9 @@ return $.widget( "ui.calendar", {
return shortWeekday.length > 3 ? weekdayNarrowFormatter( date ) : shortWeekday;
},
- formatWeekdayFull: globalize.dateFormatter({ raw: "EEEE" }),
- formatMonth: globalize.dateFormatter({ raw: "MMMM" }),
- formatWeekOfYear: globalize.dateFormatter({ raw: "w" }),
+ formatWeekdayFull: globalize.dateFormatter( { raw: "EEEE" } ),
+ formatMonth: globalize.dateFormatter( { raw: "MMMM" } ),
+ formatWeekOfYear: globalize.dateFormatter( { raw: "w" } ),
parse: this._parse
};
},
@@ -539,7 +539,7 @@ return $.widget( "ui.calendar", {
}
if ( this.options.max !== null && months[ i ].last ) {
this._disableElement( this.nextButton,
- ( this.options.max.getMonth() <= months[ i].month() &&
+ ( this.options.max.getMonth() <= months[ i ].month() &&
this.options.max.getFullYear() === months[ i ].year() ) ||
this.options.max.getFullYear() < months[ i ].year()
);
diff --git a/ui/widgets/datepicker.js b/ui/widgets/datepicker.js
index 5e0e47eb5..3534b3144 100644
--- a/ui/widgets/datepicker.js
+++ b/ui/widgets/datepicker.js
@@ -13,11 +13,11 @@
//>>docs: http://api.jqueryui.com/datepicker/
//>>demos: http://jqueryui.com/datepicker/
-(function( factory ) {
+( function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
- define([
+ define( [
"jquery",
"globalize",
"globalize/date",
@@ -32,7 +32,7 @@
// Browser globals
factory( jQuery, Globalize );
}
-}(function( $, Globalize ) {
+}( function( $, Globalize ) {
var widget = $.widget( "ui.datepicker", {
version: "@VERSION",
@@ -106,23 +106,24 @@ var widget = $.widget( "ui.datepicker", {
that._focusTrigger();
that._trigger( "select", event );
}
- }) )
+ } ) )
.calendar( "instance" );
this.calendarInstance.buttonClickContext = that.element[ 0 ];
this._setHiddenPicker();
- this.element.attr({
+ this.element.attr( {
"aria-haspopup": true,
"aria-owns": this.calendar.attr( "id" )
- });
+ } );
},
_inputEvents: {
keydown: function( event ) {
switch ( event.keyCode ) {
case $.ui.keyCode.TAB:
+
// Waiting for close() will make popup hide too late, which breaks tab key behavior
this.calendar.hide();
this.close( event );
@@ -160,7 +161,7 @@ var widget = $.widget( "ui.datepicker", {
if ( !this.suppressExpandOnFocus && !this.isOpen ) {
this._delay( function() {
this.open( event );
- });
+ } );
}
this._delay( function() {
this.suppressExpandOnFocus = false;
@@ -173,6 +174,7 @@ var widget = $.widget( "ui.datepicker", {
_calendarEvents: {
focusout: function( event ) {
+
// use a timer to allow click to clear it and letting that
// handle the closing instead of opening again
// also allows tabbing inside the calendar without it closing
@@ -186,6 +188,7 @@ var widget = $.widget( "ui.datepicker", {
mouseup: function() {
clearTimeout( this.closeTimer );
},
+
// TODO on TAB (or shift TAB), make sure it ends up on something useful in DOM order
keyup: function( event ) {
if ( event.keyCode === $.ui.keyCode.ESCAPE && this.calendar.is( ":visible" ) ) {
@@ -246,10 +249,10 @@ var widget = $.widget( "ui.datepicker", {
this.calendarInstance.refresh();
this.calendar
- .attr({
+ .attr( {
"aria-hidden": false,
"aria-expanded": true
- })
+ } )
.show()
.position( this._buildPosition() )
.hide();
@@ -274,10 +277,10 @@ var widget = $.widget( "ui.datepicker", {
},
_setHiddenPicker: function() {
- this.calendar.attr({
+ this.calendar.attr( {
"aria-hidden": true,
"aria-expanded": false
- });
+ } );
},
_buildPosition: function() {
@@ -351,12 +354,12 @@ var widget = $.widget( "ui.datepicker", {
this.calendar.position( this._buildPosition() );
}
}
-});
+} );
$.each( $.ui.datepicker.prototype.calendarOptions, function( index, option ) {
$.ui.datepicker.prototype.options[ option ] = $.ui.calendar.prototype.options[ option ];
-});
+} );
return widget;
-}));
+} ) );