Skip to main content

Bug Tracker

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 dmethvin comment:1

_comment0: So your namespace has a backslash in it? 1344045882505479
owner: → tim@xemware.com
status: newpending

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

Changed August 04, 2012 02:15AM UTC by tim@xemware.com comment:2

status: pendingnew

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 tim@xemware.com 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 dmethvin comment:4

component: unfiledevent
keywords: → needsdocs
priority: undecidedlow
resolution: → invalid
status: newclosed

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 mikesherov comment:5

keywords: needsdocs