com.google.clearsilver.jsilver.functions.escape
Class JsEscapeFunction

java.lang.Object
  extended by com.google.clearsilver.jsilver.functions.escape.SimpleEscapingFunction
      extended by com.google.clearsilver.jsilver.functions.escape.JsEscapeFunction
All Implemented Interfaces:
TextFilter

public class JsEscapeFunction
extends SimpleEscapingFunction

This Javascript escapes the string so it will be valid data for placement into a Javascript string. This converts characters such as ", ', and \ into their Javascript string safe equivilants \", \', and \\. This behaves in the same way as the ClearSilver js_escape function. This implementation has been optimized for performance.


Constructor Summary
JsEscapeFunction(boolean isAttrUnquoted)
          isUnquoted should be true if the function is escaping a string that will appear inside an unquoted JS attribute (like onClick or onMouseover).
 
Method Summary
protected  String getEscapeString(char c)
          Given one of the escape characters supplied to this instance's constructor, return the escape string for it.
 
Methods inherited from class com.google.clearsilver.jsilver.functions.escape.SimpleEscapingFunction
filter, setEscapeChars
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsEscapeFunction

public JsEscapeFunction(boolean isAttrUnquoted)
isUnquoted should be true if the function is escaping a string that will appear inside an unquoted JS attribute (like onClick or onMouseover).

Method Detail

getEscapeString

protected String getEscapeString(char c)
Description copied from class: SimpleEscapingFunction
Given one of the escape characters supplied to this instance's constructor, return the escape string for it. This method does not need to be efficient.

Specified by:
getEscapeString in class SimpleEscapingFunction


Copyright © 2010-2012 Google. All Rights Reserved.