mapbox/wax — Issue #164: clickHandler interaction in Firefox not always firing (solved)
Author: fredleefarr
Created: 2012-02-16 13:02:10+00:00
State: open

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.