string.html.HtmlSanitizer Extends goog.string.html.HtmlSaxHandler
An implementation of the goog.string.HtmlSaxHandler interface that will take each of the html tags and sanitize it.

Inheritance

Constructor

goog.string.html.HtmlSanitizer(stringBufferopt_urlPolicyopt_nmTokenPolicy)

Parameters

stringBuffer : goog.string.StringBuffer
A string buffer, used to output the html as we sanitize it.
opt_urlPolicy : ?function(string):string
An optional function to be applied in URLs.
opt_nmTokenPolicy : ?function(string):string
An optional function to be applied in names.

Instance Methods

Public Protected Private
cdata()
No description.
code »
endDoc()
No description.
code »
endTag()
No description.
code »
escapeAttrib_(s) string
Escapes HTML special characters in attribute values as HTML entities. TODO(user): use goog.string.htmlEscape instead ?
Arguments:
s : string
The string to be escaped.
Returns: string  An escaped version of s.
code »
nmTokenPolicy_()
A function to be applied to names fround on the parsing process.
code »
pcdata()
No description.
code »
rcdata()
No description.
code »
sanitizeAttributes_(tagNameattribs) Array.<?string>
Sanitizes attributes found on html entities.
Arguments:
tagName : string
The name of the tag in which the attribs were found.
attribs : Array.<?string>
An array of attributes.
Returns: Array.<?string>  A sanitized version of the attribs.
code »
startDoc()
No description.
code »
startTag()
No description.
code »
urlPolicy_()
A function to be applied to urls found on the parsing process.
code »
cdata(text)
Handler called when CDATA is found.
Arguments:
text : string
The CDATA text found.
code »
endTag(name)
Handler called when the parser found a closing tag.
Arguments:
name : string
The name of the tag that is ending.
code »
pcdata(text)
Handler called when PCDATA is found.
Arguments:
text : string
The PCDATA text found.
code »
rcdata(text)
Handler called when RCDATA is found.
Arguments:
text : string
The RCDATA text found.
code »
startTag(nameattributes)
Handler called when the parser found a new tag.
Arguments:
name : string
The name of the tag that is starting.
attributes : Array.<string>
The attributes of the tag.
code »

Instance Properties

constructor :
No description.
Code »
ignoring_ :
Whether we are ignoring what is being processed or not.
Code »
stack_ :
A stack that holds how the handler is being called.
Code »
stringBuffer_ : goog.string.StringBuffer
The string buffer that holds the sanitized version of the html. Used during the parse time.
Code »
endDoc :
Handler called when the parsing is done.
Code »
startDoc :
Handler called when the parser is starting to parse the document.
Code »

Static Properties

goog.string.html.HtmlSanitizer.superClass_ :
No description.
Code »

Enumerations

goog.string.html.HtmlSanitizer.AttributeType :
The HTML types the parser supports.
Constants:
CLASSES
No description.
FRAME_TARGET
No description.
GLOBAL_NAME
No description.
ID
No description.
IDREF
No description.
IDREFS
No description.
LOCAL_NAME
No description.
NONE
No description.
SCRIPT
No description.
STYLE
No description.
URI
No description.
URI_FRAGMENT
No description.
Code »
goog.string.html.HtmlSanitizer.Attributes :
A map of attributes to types it has.
Constants:
Code »

Package string.html

Package Reference