You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Mahendri Winata (JIRA)" <ji...@apache.org> on 2014/03/04 13:04:20 UTC
[jira] [Created] (WICKET-5524) JavaScriptUtils.escapeQuotes() does
not escape \
Mahendri Winata created WICKET-5524:
---------------------------------------
Summary: JavaScriptUtils.escapeQuotes() does not escape \
Key: WICKET-5524
URL: https://issues.apache.org/jira/browse/WICKET-5524
Project: Wicket
Issue Type: Bug
Components: wicket
Affects Versions: 6.13.0
Reporter: Mahendri Winata
We tried to use JavaScriptUtils.escapeQuotes like this:
{code}
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
attributes.getAjaxCallListeners().add(new AjaxCallListener() {
@Override
public CharSequence getPrecondition(Component component) {
return "return confirm('Anda yakin menghapus Cart " +
JavaScriptUtils.escapeQuotes(item.getModel().getObject().getPerson().getName()) + " ini?')";
}
});
super.updateAjaxAttributes(attributes);
}
{code}
However this fails when the input is: (notice the backslash)
{{Ulin Ni\'mah}}
Because the output will be:
{{Ulin Ni\\'mah}}
{{escapeQuotes()}} should also escape backslashes in addition to quotes, so it is directly usable for writing JavaScript strings from arbitrary input.
--
This message was sent by Atlassian JIRA
(v6.2#6252)