I am using the Widget factory from jQuery UI into a existing production environment.
This environment uses a binded event called sm2.validateNext which triggers before the page changes. However when trying to bind to this event using _on, it would try to split this event name and delegate it. (Which i believe is correct, bot not the expected functionality for me).
Code (inside the $.widget):
this._on(true, document, {
"sm2.validateNext": function () { ... },
});
And debugging this code, it gets delegated (not my expected behaviour) (from jquery-ui.widget.js)
var match = event.match( /^(\w+)\s*(.*)$/ ),
eventName = match[1] + instance.eventNamespace,
selector = match[2];
if ( selector ) {
delegateElement.delegate( selector, eventName, handlerProxy );
} else {
element.bind( eventName, handlerProxy );
}
Because of the . (dot) it gets a match and selector becomes valid delegating the event. However I need to get binded with its handlerProxy.
Is there a way to avoid get "trapped" into that match? I tried to escape sm2\.validateNext without result.
Note:
$(document).on("sm2.validateNext"...) Doesnt work for me as I need the instance to be at the widget object.
Thanks for your help!