Skip to main content

Search and Top Navigation

#9213 closed bug (fixed)

Opened April 07, 2013 11:58AM UTC

Closed April 10, 2013 02:46AM UTC

Last modified April 17, 2013 07:32PM UTC

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

1. call the reset method on a form that contains buttons and buttonsets

2. remove some part of that form that contains those buttons and buttonsets (so removing the buttons)

3. 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!

Attachments (0)
Change History (7)

Changed April 07, 2013 02:33PM UTC by tj.vantoll comment:1

status: newopen
summary: timeout in formResetHandlerButton: timeout in formResetHandler causing refresh to be called on non-widgets

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.

Changed April 07, 2013 02:34PM UTC by tj.vantoll comment:2

owner: → tj.vantoll
status: openassigned

Changed April 07, 2013 04:59PM UTC by tj.vantoll comment:3

Changed April 10, 2013 02:46AM UTC by TJ VanToll comment:4

resolution: → fixed
status: assignedclosed

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

Changed April 10, 2013 02:49AM UTC by tj.vantoll comment:5

milestone: none1.11.0

Changed April 17, 2013 07:32PM UTC by TJ VanToll comment:6

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

Changed April 17, 2013 07:32PM UTC by scottgonzalez comment:7

milestone: 1.11.01.10.3