-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Description
Description
I have an issue for unbind an event created for a component having a colon character in its id.
The colon character is used as separator by the JSF API.
The event is bind like this:
var elementId = document.getElementById('test:colon').id.replace(':', '\\:'),
selector = '#' + elementId + ' .clickMe';
$(document).on('click.xxx-' + elementId, selector, function (){alert('clicked');});
But the off function does not unbing the event:
$(document).off('click.xxx-' + elementId, selector);
The issue appear in the off function on the line:
( !tmp || tmp.test( handleObj.namespace ) )
The regex pattern failed to test the expression because of the escape character...
If you change the line:
tmp = tmp[ 2 ] && new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
by escaping the \ character:
tmp = tmp[ 2 ] && new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ).replace('\\', '\\\\') + "(\\.|$)" );
seem to works in the chrome debugger:
- What do you expect to happen?
Event must be unbind - What actually happens?
Event is not unbind - Which browsers are affected?
All browsers