Namespace: Strings:maskForHtml

Strings:maskForHtml

Source:

Methods

maskForHtml(text) → {String}

Masks a string possibly containing reserved HTML chars for HTML output as is (so a < actually reads on the page).

Only replaces critical chars like <>& with entities, but keeps non-critical unicode chars like »/.

Parameters:
Name Type Description
text String

the string to mask for use in HTML

Source:
See:
Returns:
the masked string
Type
String
Example
maskForHtml('</>&;üäöÜÄÖß– »')
=> '&lt;/&gt;&amp;;üäöÜÄÖß– »'