nsIScriptableUnescapeHTML 编辑
parser/html/nsIScriptableUnescapeHTML.idl
Scriptable This interface is a utility interface that exposes the kind of markup parser behavior that the feed service needs. 1.0 66 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 thefragment
is an XML string; otherwise set it tofalse
. baseURI
- Pointer to the base URI against which to resolve any URIs included in the fragment. This parameter is ignored if
isXML
isfalse
. 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论