Permalink
Browse files

[formReset] New behaviour that allows form widgets to become aware of…

… the fact that the form they are in has been reset
  • Loading branch information...
gabrielschulhof committed Oct 23, 2012
1 parent 398ecd9 commit 0f212b3e5477f356fa8c86544e0d801d3f28da33
Showing with 28 additions and 1 deletion.
  1. +2 −1 js/index.php
  2. +3 −0 js/jquery.mobile.core.js
  3. +23 −0 js/widgets/forms/reset.js
View
@@ -19,7 +19,7 @@
'jquery.hashchange.js',
'widgets/page.js',
'jquery.mobile.core.js',
'widgets/loader.js',
'widgets/loader.js',
'jquery.mobile.navigation.js',
'jquery.mobile.navigation.pushstate.js',
'jquery.mobile.transition.js',
@@ -42,6 +42,7 @@
'widgets/listview.filter.js',
'widgets/listview.autodividers.js',
'jquery.mobile.nojs.js',
'widgets/forms/reset.js',
'widgets/forms/checkboxradio.js',
'widgets/forms/button.js',
'widgets/forms/slider.js',
View
@@ -120,6 +120,9 @@ define( [ "jquery", "text!../version.txt" ], function( $, __version__ ) {
WINDOWS: 91 // COMMAND
},
// Place to store various widget extensions
behaviors: {},
// Scroll page vertically: scroll to 0 to hide iOS address bar, or pass a Y value
silentScroll: function( ypos ) {
if ( $.type( ypos ) !== "number" ) {
View
@@ -0,0 +1,23 @@
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
//>>description: Make a widget react to a form's reset.
//>>label: formReset
//>>group: Forms
define( [ "jquery", "../../jquery.mobile.core" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {
$.mobile.behaviors.formReset = {
_handleFormReset: function() {
this._on( this.element.closest( "form" ), {
reset: function() {
this._delay( "_reset" );
}
});
}
};
})( jQuery );
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
});
//>>excludeEnd("jqmBuildExclude");

0 comments on commit 0f212b3

Please sign in to comment.