Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

81 Zeilen
1.8 KiB

  1. /*!
  2. * jQuery UI Form Reset Mixin 1.13.1
  3. * http://jqueryui.com
  4. *
  5. * Copyright jQuery Foundation and other contributors
  6. * Released under the MIT license.
  7. * http://jquery.org/license
  8. */
  9. //>>label: Form Reset Mixin
  10. //>>group: Core
  11. //>>description: Refresh input widgets when their form is reset
  12. //>>docs: http://api.jqueryui.com/form-reset-mixin/
  13. ( function( factory ) {
  14. "use strict";
  15. if ( typeof define === "function" && define.amd ) {
  16. // AMD. Register as an anonymous module.
  17. define( [
  18. "jquery",
  19. "./form",
  20. "./version"
  21. ], factory );
  22. } else {
  23. // Browser globals
  24. factory( jQuery );
  25. }
  26. } )( function( $ ) {
  27. "use strict";
  28. return $.ui.formResetMixin = {
  29. _formResetHandler: function() {
  30. var form = $( this );
  31. // Wait for the form reset to actually happen before refreshing
  32. setTimeout( function() {
  33. var instances = form.data( "ui-form-reset-instances" );
  34. $.each( instances, function() {
  35. this.refresh();
  36. } );
  37. } );
  38. },
  39. _bindFormResetHandler: function() {
  40. this.form = this.element._form();
  41. if ( !this.form.length ) {
  42. return;
  43. }
  44. var instances = this.form.data( "ui-form-reset-instances" ) || [];
  45. if ( !instances.length ) {
  46. // We don't use _on() here because we use a single event handler per form
  47. this.form.on( "reset.ui-form-reset", this._formResetHandler );
  48. }
  49. instances.push( this );
  50. this.form.data( "ui-form-reset-instances", instances );
  51. },
  52. _unbindFormResetHandler: function() {
  53. if ( !this.form.length ) {
  54. return;
  55. }
  56. var instances = this.form.data( "ui-form-reset-instances" );
  57. instances.splice( $.inArray( this, instances ), 1 );
  58. if ( instances.length ) {
  59. this.form.data( "ui-form-reset-instances", instances );
  60. } else {
  61. this.form
  62. .removeData( "ui-form-reset-instances" )
  63. .off( "reset.ui-form-reset" );
  64. }
  65. }
  66. };
  67. } );