New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

destroy button widget fails with "this.button is undefined" error #7490

Closed
fdummert opened this Issue Jun 11, 2014 · 2 comments

Comments

Projects
None yet
3 participants
@fdummert

fdummert commented Jun 11, 2014

The _destroy method of a form button widget has a reference to "this.button" which is never populated:

_destroy: function() {
    this.element.insertBefore( this.button );
    this.button.remove();
}

A $(...).button("destroy") call consequently fails with an "this.button is undefined" error.

This bug was introduced by this commit and could be resolved by replacing "this.button" with "this.wrapper":

_destroy: function() {
    this.element.insertBefore( this.wrapper );
    this.wrapper.remove();
}
@jaspermdegroot

This comment has been minimized.

Show comment
Hide comment
@jaspermdegroot

jaspermdegroot Jun 11, 2014

Member

@fdummert

Thanks for reporting the issue. Please, always include a test page when reporting bugs. See our contributing guidelines.

I created one for this issue: http://jsbin.com/sekujuqa/2/edit

@arschmitz - Should button be replaced by wrapper?

_destroy: function() {
    this.element.insertBefore( this.wrapper );
    this.wrapper.remove();
}
Member

jaspermdegroot commented Jun 11, 2014

@fdummert

Thanks for reporting the issue. Please, always include a test page when reporting bugs. See our contributing guidelines.

I created one for this issue: http://jsbin.com/sekujuqa/2/edit

@arschmitz - Should button be replaced by wrapper?

_destroy: function() {
    this.element.insertBefore( this.wrapper );
    this.wrapper.remove();
}

@jaspermdegroot jaspermdegroot added this to the 1.4.4 milestone Jun 11, 2014

@gabrielschulhof gabrielschulhof self-assigned this Jun 11, 2014

@gabrielschulhof

This comment has been minimized.

Show comment
Hide comment
@gabrielschulhof

gabrielschulhof Jun 11, 2014

Contributor

Yeah, I think that's it. this.button is an instance-level variable that is only referenced in _destroy() and not initialized anywhere.

Contributor

gabrielschulhof commented Jun 11, 2014

Yeah, I think that's it. this.button is an instance-level variable that is only referenced in _destroy() and not initialized anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment