Namespace: text

ix. text

Extends

Classes

SimpleDateFormat

Methods

<static> canonicalize(input, strict) → {String}

Canonicalization (also called normalization) is the act of reducing a string to it’s simplest form. For example, if the string %3CB%3E is passed into the canonicalize method, the value returned will be decoded into <b>. The most important part of this method is that it will detect if a string is passed in that contains either multiple encoding types, or double encoding, or both. The default behavior of the method is to raise an exception if it detects one of these scenarios. As a general rule, normal application operation should never pass data that is either double encoded or encoded using multiple escaping rules. Most definately, data that is provided by a user (such as a form field) will never contain data that fits that description.

Parameters:
Name Type Argument Default Description
input String <optional>
""
strict boolean <optional>
false
Returns:

normalized

Type
String

<static> encodeForCSS(propName, input, omitPropertyName) → {String}

This method allows developers to encode data specifically to be inserted into the style attribute of an element or as the value of a style attribute passed in through the jQuery .style() method.

Parameters:
Name Type Argument Default Description
propName String <optional>
""
input String <optional>
""
omitPropertyName Array.<Char> <optional>
false
Returns:

encoded

Type
String

<static> encodeForHTML(input) → {String}

This method allows developers to encode data specifically to be inserted between two tags in a document, either through the use of the html() method or by accessing innerHTML directly.

Parameters:
Name Type Argument Default Description
input String <optional>
""
Returns:

encoded

Type
String

<static> encodeForHTMLAttribute(attr, input, omitAttributeName) → {String}

This method allows developers to encode data specifically to be inserted between quotes in an HTML Attribute value.

Parameters:
Name Type Argument Default Description
attr String <optional>
""
input String <optional>
""
omitAttributeName boolean <optional>
false
Returns:

encoded

Type
String

<static> encodeForJavascript(input) → {String}

This method allows developers to encode data specifically to be inserted into a javascript event on an DOM element. This method will escape for a javascript context instead of a html attribute context.

Parameters:
Name Type Description
input String
Returns:

encoded

Type
String

<static> encodeForURL(input, attr) → {String}

This method allows developers to encode data specifically to be inserted into a URL context. This is useful for encoding links with untrusted data in them.

Parameters:
Name Type Argument Default Description
input String <optional>
attr String <optional>
""
Returns:

encoded

Type
String