Namespace jabberwerx.xhtmlim (MINIMAL)
Namespace for XHTML-IM functions and constants.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
<static> |
jabberwerx.xhtmlim.allowedStyles
An array of css style properties that may be included in xhtml-im.
|
<static> |
jabberwerx.xhtmlim.allowedTags
A map of tags that may be included in xhtml-im.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
jabberwerx.xhtmlim.sanitize(DOM)
Sanitize xhtmlNode by applying XEP-71 recommended profile.
|
Field Detail
<static>
jabberwerx.xhtmlim.allowedStyles
An array of css style properties that may be included in xhtml-im.
Default values are from XEP-71 Recommended Profile but may be modified
at anytime. For example some clients may want to ignore font size
property would add the following to their initialization code:
delete jabberwerx.xhtmlim.allowedStyles[ jabberwerx.xhtmlim.allowedStyles.indexOf("font-size") ];
<static>
jabberwerx.xhtmlim.allowedTags
A map of tags that may be included in xhtml-im. The defaults are defined
in XEP-71 Recommended Profile. The map is indexed by tag and provides an
array of allowed attributes for that tag. Clients may modify this map at
any time to change behavior. For example a client that wanted to include
table tags would add the following to their initialization code:
jabberwerx.$.extend(jabberwerx.xhtmlim.allowedTags,{ table: ["style", "border", "cellpadding", "cellspacing", "frame", "summary", "width"] })
Method Detail
<static>
jabberwerx.xhtmlim.sanitize(DOM)
Sanitize xhtmlNode by applying XEP-71 recommended profile.
Each node in the given DOM is checked to make sure it is an
jabberwerx.xhtmlim.allowedTags, with allowed attributes and
style values. If a node is not allowed it is removed from the DOM and
its children reparented to its own parent. If an attribute is not
allowed it is removed. If the attribute's name is "href" or "src" and
its value starts with 'javascript:', its element is removed and the
children reparented. Finally any css values not in the
jabberwerx.xhtmlim.allowedStyles array is removed from the style
attribute.
xhtmlNode must be a <body/> or one of the other allowed tags.
Typical usage of this function would be to clean an html fragment (an
entire <p/> for instance) or in preperation for a message stanza
by passing a <body/> element.
- Parameters:
- DOM
- xhtmlNode
- Throws:
- TYPE_ERROR if xhtmlNode is not a DOM or not an allowed tag
- Returns:
- DOM A reference to xhtmlNode