Skip to content

Instantly share code, notes, and snippets.

@sdesai
Created February 1, 2011 01:39
Show Gist options
  • Save sdesai/805247 to your computer and use it in GitHub Desktop.
Save sdesai/805247 to your computer and use it in GitHub Desktop.
Patch node.remove to fix single box widget destructor
testSingleBoxDestroy: function() {
(function(origRemove) {
Y.Node.prototype.remove = function() {
if (this._node) {
origRemove.apply(this, arguments);
}
}
})(Y.Node.prototype.remove);
function MyWidget() {
MyWidget.superclass.constructor.apply(this, arguments);
};
MyWidget.NAME = "myWidget";
Y.extend(MyWidget, Y.Widget, {
CONTENT_TEMPLATE:null
});
var w = new MyWidget();
try {
w.destroy();
} catch(e) {
Y.Assert.fail("w.destroy() on a single box widget threw an exception" + e);
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment