Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

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

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

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

fdummert opened this issue Jun 11, 2014 · 2 comments
Assignees
Milestone

Comments

@fdummert
Copy link

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
Copy link
Contributor

@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
Copy link

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants