Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clickHandler interaction in Firefox not always firing (solved) #164

Closed
fredleefarr opened this issue Feb 16, 2012 · 3 comments
Closed

clickHandler interaction in Firefox not always firing (solved) #164

fredleefarr opened this issue Feb 16, 2012 · 3 comments

Comments

@fredleefarr
Copy link

I noticed that the clickHander interaction wasn't always correctly triggering in FF in my application. Chrome (and even IE!) worked fine, so I drilled down into wax.mm.js. In the function "templatedGridUrl" I found that the following regex sometimes randomly returned null:

var xyz = /(\d+)/(\d+)/(\d+).[\w._]+/g.exec(url);

I replaced this line with:

var rx = new RegExp("/(\d+)/(\d+)/(\d+).[\w._]+");
var xyz = rx.exec(url);

And now it seems to be fine. Might just be an issue at my end. I found the solution in some comments in this Stack Overflow question: http://stackoverflow.com/questions/4724701/regexp-exec-returns-null-sporadically

As a side note, I've added a renderer for UtfGrid for .net based on some original code by Dane Springmeyer:

https://github.com/fredleefarr/UTFGrid-Renderer

I couldn't find Dane's original repo so couldn't link to it.

@tmcw
Copy link

tmcw commented Feb 16, 2012

Ah, thanks so much for tracking this down! Must have run into it a while ago but not fixed it entirely, and it became lore that Firefox somehow had a broken regex implementation, but I had no examples.

I'll do a quick backport for a 4.1.6 release with this fix. Thanks @fredleefarr !

@fredleefarr
Copy link
Author

No problem. Just in case you implement the code snippet above and get an error, the backslashes in the regex expression need to be doubled to escape them when used with "new RegExp()".

tmcw added a commit that referenced this issue Feb 16, 2012
Firefox has a crazy weird bug in their regex implementation
and this constructs regexes with the official constructor,
every time. A millisecond performance hit is to be expected.
@tmcw
Copy link

tmcw commented Feb 16, 2012

Fixed in 4.1.7, thanks!

@tmcw tmcw closed this as completed Feb 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants