Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#12194 closed bug (invalid)

customEvent: error in code for building event.namespace_re

Reported by: [email protected] Owned by: [email protected]
Priority: low Milestone: None
Component: event Version: 1.8rc1
Keywords: Cc:
Blocked by: Blocking:


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 Changed 9 years ago by dmethvin

Owner: set to [email protected]
Status: newpending

So your namespace has a backslash in it?

Version 0, edited 9 years ago by dmethvin (next)

comment:2 Changed 9 years ago by [email protected]

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.

comment:3 in reply to:  1 Changed 9 years ago by [email protected]

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 years ago by dmethvin

Component: unfiledevent
Keywords: needsdocs added
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.

comment:5 Changed 9 years ago by mikesherov

Keywords: needsdocs removed
Note: See TracTickets for help on using tickets.