Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsIScriptableUnescapeHTML

This interface is a utility interface that exposes the kind of markup parser behavior that the feed service needs.
1.0
28
Introduced
Gecko 1.8
Obsolete
Gecko 14.0
Inherits from: nsISupports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

Note: As of Firefox 14, this interface is obsolete (but still available for compatibility with legacy extensions) and all its functionality is available with more configuration options via the nsIParserUtils interface.

Implemented by: @mozilla.org/feed-unescapehtml;1 as a service:

var scriptableUnescapeHTML = Components.classes["@mozilla.org/feed-unescapehtml;1"]
                             .getService(Components.interfaces.nsIScriptableUnescapeHTML);

Method overview

nsIDOMDocumentFragment parseFragment(in AString fragment, in PRBool isXML, in nsIURI baseURI, in nsIDOMElement element);
AString unescape(in AString src);

Methods

parseFragment()

Parses a string of HTML or XML source into a sanitized DocumentFragment.

This is equivalent to calling nsIParserUtils::parseFragment(fragment, 0, isXML, baseURI, element). You should call nsIParserUtils::parseFragment() instead of calling this method.

nsIDOMDocumentFragment parseFragment(
  in AString fragment,
  in PRBool isXML,
  in nsIURI baseURI,
  in nsIDOMElement element
);
Parameters
fragment
A string of HTML or XML source to parse as a fragment.
isXML
Set this to true if the fragment is an XML string; otherwise set it to false.
baseURI
Pointer to the base URI against which to resolve any URIs included in the fragment. This parameter is ignored if isXML is false.
element
The nsIDOMElement to be used as the context node for the purposes of the fragment parsing algorithm.
Return value

An nsIDOMDocumentFragment of the element with the new text appended.

Exceptions thrown
NS_ERROR_FAILURE
Unable to append the text to the element.

unescape()

Convents HTML source into plain text.

This is equivalent to calling nsIParserUtils::convertToPlainText(src, nsIDocumentEncoder::OutputSelectionOnly | nsIDocumentEncoder::OutputAbsoluteLinks, 0). You should call nsIParserUtils::convertToPlainText() instead of calling this method.

AString unescape(
  in AString src
);
Parameters
src
The HTML string to convert into plain text.
Return value

The result of the plain text conversion.

Exceptions thrown
NS_ERROR_FAILURE
Unable to convert the string.

See also

Document Tags and Contributors

 Contributors to this page: Sheppy, Hsivonen, trevorh, Nickolay, Planche
 Last updated by: Sheppy,