fix($interpolate): always unescape escaped interpolation markers #14199
base: master
Are you sure you want to change the base?
fix($interpolate): always unescape escaped interpolation markers #14199
Conversation
Previously, whenever `mustHaveExpression` was true (e.g. when compiling a text node), `$interpolate` would not unescape the escaped interpolation markers if there were no actual interpolation expressions in the same string. This commit fixes the problem, by always unescaping the escaped markers (if any). Due to always checking for the presence of escaped interpolation markers, there is a slight performance hit. Fixes angular#14196
I wonder if this is a BC. Possible breakages:
|
This PR brings a new level of complexity when people want to have the This is, we should unescape everything (not only On Tuesday, March 8, 2016, Georgios Kalpakas notifications@github.com
|
Maybe I didn't understand well, but with the current behavior, |
@gkalpak agree, but this PR moves the issue from one pattern to another :) |
I think this looks good to me. The issue that @lgalfaso points out is already a problem for text blocks that contain interpolation expressions anyway. This just brings consistency between blocks that do and do not contain interpolation expressions. |
Breaking change? Well at the moment I would argue that the escaping is broken, since it is inconsistent and I doubt that anyone is really relying on these escaped sequences not being unescaped in text blocks that do not contain interpolation expressions. |
@petebacondarwin if this PR lands, how would you write |
I am not sure. But however you do it after this PR it will be the same as you would do it before the PR, in the case that there was some interpolated expression in the same text block. One ugly way would be to do...
|
I think everybody agrees that the current is less than ideal. I would not On Wednesday, March 9, 2016, Pete Bacon Darwin notifications@github.com
|
The new limitation that worked before was that this PR fixes the inconsistency that if a text node did not contain any interpolations then we would not try to unescape our publicly documented escape sequence for curly braces. I would say that this was such a weird inconsistency that no one could have been using the escaping effectively, since their server-side escaping mechanism must have been able to ascertain whether a set of double curlies, which were supposed to be rendered as-is, appeared in a text block that actually contained a set of double curlies, which were supposed to be interpolated. I agree that we need a clear way of escaping the escape sequence. |
Previously, whenever
mustHaveExpression
was true (e.g. when compiling a text node),$interpolate
would not unescape the escaped interpolation markers if there were no actualinterpolation expressions in the same string.
This commit fixes the problem, by always unescaping the escaped markers (if any).
Due to always checking for the presence of escaped interpolation markers, there is a slight
performance hit.
Fixes #14196