Problem with $$ being replaced with $
CycoPH opened this issue · 2 comments
There is a problem where the data coming from the context is not put into the template correctly.
template:
password={{pwd}}
context:
{"pwd": "abc$$def"}
This will result in the password being abc$def and NOT abc$$def.
Found the same issue in a different context. We're running some JS through UglifyJS and then injecting that into an HTML template using Markup.js as part of a build process. Uglify replaces some variables with $
and, under the right circumstances, this breaks the replacement on L320 of markup.js.
Our specific example is the variable replaced by $
is used in a condition followed by &&
. The resulting string, $&&
, is interpreted by replace
to insert the matched substring so our template token is inserted in that location.
Found that replacing all $
with $$
in the source value resolves the issue.
template = template.replace(tag, result === undefined ? "???" : result.replace(/\$/g, '$$$$'));
Simple repro:
http://jsfiddle.net/va8f9mh4/1/
is there any solution / workaround for this, except replacing the value of input set?