#12194 closed bug (invalid)
customEvent: error in code for building event.namespace_re
Reported by: | Owned by: | ||
---|---|---|---|
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:\"]
Change History (5)
comment:1 follow-up: 3 Changed 11 years ago by
Owner: | set to tim@… |
---|---|
Status: | new → pending |
comment:2 Changed 11 years ago by
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.
comment:3 Changed 11 years ago by
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 11 years ago by
Component: | unfiled → event |
---|---|
Keywords: | needsdocs added |
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.
comment:5 Changed 11 years ago by
Keywords: | needsdocs removed |
---|
So your namespace has a backslash in it?