Permalink
Browse files

Dependencies: add jquery-ui/form-reset-mixin.js

  • Loading branch information...
gabrielschulhof authored and arschmitz committed Feb 3, 2016
1 parent 76c41e3 commit 669e085421aec099ef7436ddd8d21e507ddf7f71
@@ -45,6 +45,10 @@ return {
},
files: {
"jquery-ui/core.js": "jquery-ui/ui/core.js",
"jquery-ui/version.js": "jquery-ui/ui/version.js",
"jquery-ui/form.js": "jquery-ui/ui/form.js",
"jquery-ui/form-reset-mixin.js": "jquery-ui/ui/form-reset-mixin.js",
"jquery-ui/form-reset-mixin.js": "jquery-ui/ui/form-reset-mixin.js",
"jquery-ui/widget.js": "jquery-ui/ui/widget.js",
"jquery-ui/accordion.js": "jquery-ui/ui/accordion.js",
"jquery-ui/tabs.js": "jquery-ui/ui/tabs.js",
@@ -0,0 +1,77 @@
/*!
* jQuery UI Form Reset Mixin @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: Form Reset Mixin
//>>group: Core
//>>description: Refresh input widgets when their form is reset
//>>docs: http://api.jqueryui.com/form-reset-mixin/
( function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [
"jquery",
"./form",
"./version"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}( function( $ ) {
return $.ui.formResetMixin = {
_formResetHandler: function() {
var form = $( this );
// Wait for the form reset to actually happen before refreshing
setTimeout( function() {
var instances = form.data( "ui-form-reset-instances" );
$.each( instances, function() {
this.refresh();
} );
} );
},
_bindFormResetHandler: function() {
this.form = this.element.form();
if ( !this.form.length ) {
return;
}
var instances = this.form.data( "ui-form-reset-instances" ) || [];
if ( !instances.length ) {
// We don't use _on() here because we use a single event handler per form
this.form.on( "reset.ui-form-reset", this._formResetHandler );
}
instances.push( this );
this.form.data( "ui-form-reset-instances", instances );
},
_unbindFormResetHandler: function() {
if ( !this.form.length ) {
return;
}
var instances = this.form.data( "ui-form-reset-instances" );
instances.splice( $.inArray( this, instances ), 1 );
if ( instances.length ) {
this.form.data( "ui-form-reset-instances", instances );
} else {
this.form
.removeData( "ui-form-reset-instances" )
.off( "reset.ui-form-reset" );
}
}
};
} ) );
View
@@ -0,0 +1,20 @@
( function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} ( function( $ ) {
// Support: IE8 Only
// IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
// with a string, so we need to find the proper form.
return $.fn.form = function() {
return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form );
};
} ) );
@@ -0,0 +1,17 @@
( function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} ( function( $ ) {
$.ui = $.ui || {};
return $.ui.version = "@VERSION";
} ) );
View
@@ -17,6 +17,9 @@
'events/throttledresize.js',
'events/orientationchange.js',
'../external/jquery-ui/core.js',
'../external/jquery-ui/version.js',
'../external/jquery-ui/form.js',
'../external/jquery-ui/form-reset-mixin.js',
'defaults.js',
'helpers.js',
'data.js',

0 comments on commit 669e085

Please sign in to comment.