Unbinding events for 1.8 plugins in 1.9

Unbinding events for 1.8 plugins in 1.9

In widget factory 1.8 i used to bind event like this:

this.element.on("click." + this.widgetName, $.proxy(this._doStuff, this));

Which got automatically unbound when calling the destroy method.

Now in widget factory 1.9 there is a eventNamespace variable which seems to be the widgetName + some number.

this._on($element, { click: this._doStuff });

Is essentially the same as:

this.element.on("click." + this.eventNamespace, $.proxy(this._doStuff, this));

In the destroy method jQuery UI1.9 event are unbound like this: