We’re using Flash to inject javascript onto our page, and to save space, we’re using a minifier to produce smaller javascript code. The issue is that we’re using a string replacement on our code and the minifier produces an odd result.
Consider the following code:
var id = myobj['ID_PLACEHOLDER'];
When we inject the code, we do a replace on ID_PLACEHOLDER and replace it with the appropriate ID. This is great, except that our minifier sees this as a waste of chars and minifies the system to:
var id = myobj.ID_PLACEHOLDER;
This would be well and good except that our IDs can begin with numbers and Javascript variables cannot. To solve this, I had to modify our placeholder to be:
var id = myobj['1_ID_PLACEHOLDER'];
This does not minify and produces correct code on the injected end.