Ticket #12194 (closed bug: invalid)
customEvent: error in code for building event.namespace_re
| Reported by: | tim@… | Owned by: | tim@… |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | event | Version: | 1.8rc1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
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:\"]
Change History
comment:1 follow-up: ↓ 3 Changed 10 months ago by dmethvin
- Owner set to tim@…
- Status changed from new to pending
comment:2 Changed 10 months ago by tim@…
- Status changed from pending to 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.
comment:3 in reply to: ↑ 1 Changed 10 months ago by tim@…
Replying to 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
comment:4 Changed 9 months ago by dmethvin
- Keywords needsdocs added
- Priority changed from undecided to low
- Status changed from new to closed
- Component changed from unfiled to event
- Resolution set to invalid
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.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

So your namespace has a backslash in it? Please provide a test case in jsFiddle.