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
BUG Make UI widget destroys more consistent to avoid exceptions. #3286
Conversation
Probably should use |
Don't merge yet, still testing. |
Ok, I think it's ready. |
}, | ||
|
||
onunmatch: function() { | ||
this._super(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any benefit to this? It does nothing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It makes onmatch work. If onmatch is present, but onunmatch isn't, onmatch might short-circuit bypassing some handlers.
Removed that fine example of a cargo-cult programming. |
}, | ||
|
||
onunmatch: function() { | ||
this._super(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't our revelation that onunmatch relies on onmatch, but not the other way around?
Fixed up. |
Perfect. Will merge, but can you please squash your commits? |
1. Add missing _super calls. 2. Make UI widget destroys more consistent to avoid exceptions. Selectable would throw an exception in the GridField.js if destroy called from onunmatch - at that stage jQuery UI would have had called the destroy already. Add a guard, and change to onremove, which triggers before the element is removed from DOM. 3. DOM traversal fails after the element is removed from DOM. Onunmatch triggers after the removal of the element from the DOM, which makes DOM traversal fail. Use onremove instead, which triggers while the element is still in DOM.
'ere, squished. |
Ok, hope all the tests pass. |
BUG Make UI widget destroys more consistent to avoid exceptions.
Selectable would throw an exception in the GridField.js if destroy
called from onunmatch - at that stage jQuery UI would have had called
the destroy already. Add a guard, and change to onremove, which triggers
before the element is removed from DOM.