Side navigation
#12194 closed bug (invalid)
Opened August 04, 2012 01:59AM UTC
Closed August 21, 2012 01:34AM UTC
Last modified October 15, 2012 10:17PM UTC
customEvent: error in code for building event.namespace_re
Reported by: | tim@xemware.com | Owned by: | tim@xemware.com |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | event | Version: | 1.8rc1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Line 3151 of 1.7.2
event.namespace_re = event.namespace? new RegExp("(^|\\\\.)" + namespaces.join("\\\\.(?:.*\\\\.)?") + "(\\\\.|$)") : null;
When last array item in 'namespaces' ends with \\ it fails with error (Chrome):
SyntaxError: Invalid regular expression: /(^|\\.)dynatree\\.(?:.*\\.)?file-browser-tree\\.(?:.*\\.)?u:\\(\\.|$)/: Unmatched ')'
Example: ["dynatree", "file-browser-tree", "u:\\"]
Attachments (0)
Change History (5)
Changed August 04, 2012 02:03AM UTC by comment:1
_comment0: | So your namespace has a backslash in it? → 1344045882505479 |
---|---|
owner: | → tim@xemware.com |
status: | new → pending |
Changed August 04, 2012 02:15AM UTC by comment:2
status: | pending → new |
---|
Sorry struggling to figure out how to code this in jsFiddle having never set up my own before, but this is the crux of it:
var self = {};
$('body').trigger("nodeLoaded.dynatree.file-browser-tree.u:\\\\", [self, true]);
It's an event generated by a 3rd party javascript library.
For time being I have changed to forward slash.
Changed August 04, 2012 02:17AM UTC by comment:3
Replying to [comment:1 dmethvin]:
So your namespace has a backslash in it? Please provide a test case in jsFiddle.
The system stripped out two back slashes between u: and " e.g. \\ \\ but no space, ie escaped backslash
Changed August 21, 2012 01:34AM UTC by comment:4
component: | unfiled → event |
---|---|
keywords: | → needsdocs |
priority: | undecided → low |
resolution: | → invalid |
status: | new → closed |
I don't think there is any need to change code, let's add some docs advising that event names should contain only alphanumerics, underscore, and colon. The dot is reserved for namespaces and we don't need a way to escape it.
Changed October 15, 2012 10:17PM UTC by comment:5
keywords: | needsdocs |
---|
So your namespace has a backslash in it? Please provide a test case in jsFiddle.