#9213 closed bug (fixed)
Button: timeout in formResetHandler causing refresh to be called on non-widgets
Reported by: | krampstudio | Owned by: | tj.vantoll |
---|---|---|---|
Priority: | minor | Milestone: | 1.10.3 |
Component: | ui.button | Version: | 1.10.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Why is there a timeout into the formResetHandler function, it causes me a lot of trouble after the upgrade of jQuery to version 1.9.1 ?
The formResetHandler function from jquery-ui 1.10.2:
formResetHandler = function() { var buttons = $( this ).find( ":ui-button" ); setTimeout(function() { buttons.button( "refresh" ); }, 1 );
My use case was to
- call the reset method on a form that contains buttons and buttonsets
- remove some part of that form that contains those buttons and buttonsets (so removing the buttons)
- Because the execution order isn't guaranted due to the setTimeout, I was getting the error: cannot call methods on button prior to initialization; attempted to call method refresh because the button is removed before the form.reset.
I'm wondering if the setTimeout is useful.
See the test case at http://jsfiddle.net/krampstudio/FaFby/1/
Thank you!
Change History (7)
comment:1 Changed 10 years ago by
Status: | new → open |
---|---|
Summary: | timeout in formResetHandler → Button: timeout in formResetHandler causing refresh to be called on non-widgets |
comment:2 Changed 10 years ago by
Owner: | set to tj.vantoll |
---|---|
Status: | open → assigned |
comment:4 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Button: On form reset only call refresh on current button widgets. Fixed #9213: Button: timeout in formResetHandler causing refresh to be called on non-widgets
Changeset: 2de31fdbf498a6c20d196a96d007ea0f069644c5
comment:5 Changed 10 years ago by
Milestone: | none → 1.11.0 |
---|
comment:6 Changed 10 years ago by
Button: On form reset only call refresh on current button widgets. Fixed #9213: Button: timeout in formResetHandler causing refresh to be called on non-widgets (cherry picked from commit 2de31fdbf498a6c20d196a96d007ea0f069644c5)
Changeset: 1152e6591740765d2a1c261714ea9e409bf94cb5
comment:7 Changed 10 years ago by
Milestone: | 1.11.0 → 1.10.3 |
---|
I believe the setTimeout is there so that the refresh call occurs after the form reset has processed. This is a legitimate use case so I'd say we should probably find buttons within the setTimeout function itself. I'll take a stab at this.