⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 overview-summary-sarissa.js.html

📁 sarissa用于支持多浏览器的浏览及编程
💻 HTML
📖 第 1 页 / 共 4 页
字号:
    &amp;&amp; Sarissa.getDomDocument(<span class="literal">""</span>,<span class="literal">"foo"</span>, null).xml){    <span class="comment">/**     * Utility class to serialize DOM Node objects to XML strings     * <span class="attrib">@constructor</span>     */</span>    XMLSerializer = <span class="reserved">function</span>(){};    <span class="comment">/**     * Serialize the given DOM Node to an XML string     * <span class="attrib">@param</span> oNode the DOM Node to serialize     */</span>    XMLSerializer.<span class="reserved">prototype</span>.serializeToString = <span class="reserved">function</span>(oNode) {        <span class="reserved">return</span> oNode.xml;    };};<span class="comment">/** * strips tags from a markup string */</span>Sarissa.stripTags = <span class="reserved">function</span> (s) {    <span class="reserved">return</span> s.replace(/&lt;[^&gt;]+&gt;/g,<span class="literal">""</span>);};<span class="comment">/** * &lt;p&gt;Deletes all child nodes of the given node&lt;/p&gt; * <span class="attrib">@argument</span> oNode the Node to empty */</span>Sarissa.clearChildNodes = <span class="reserved">function</span>(oNode) {    <span class="comment">// need to check for firstChild due to opera 8 bug with hasChildNodes</span>    <span class="reserved">while</span>(oNode.firstChild) {        oNode.removeChild(oNode.firstChild);    };};<span class="comment">/** * &lt;p&gt; Copies the childNodes of nodeFrom to nodeTo&lt;/p&gt; * &lt;p&gt; &lt;b&gt;Note:&lt;/b&gt; The second object's original content is deleted before  * the copy operation, unless you supply a true third parameter&lt;/p&gt; * <span class="attrib">@argument</span> nodeFrom the Node to copy the childNodes from * <span class="attrib">@argument</span> nodeTo the Node to copy the childNodes to * <span class="attrib">@argument</span> bPreserveExisting whether to preserve the original content of nodeTo, default is false */</span>Sarissa.copyChildNodes = <span class="reserved">function</span>(nodeFrom, nodeTo, bPreserveExisting) {    <span class="reserved">if</span>((!nodeFrom) || (!nodeTo)){        throw <span class="literal">"Both source and destination nodes must be provided"</span>;    };    <span class="reserved">if</span>(!bPreserveExisting){        Sarissa.clearChildNodes(nodeTo);    };    var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;    var nodes = nodeFrom.childNodes;    <span class="reserved">if</span>(typeof(ownerDoc.importNode) != <span class="literal">"undefined"</span>)  {        <span class="reserved">for</span>(var i=0;i &lt; nodes.length;i++) {            nodeTo.appendChild(ownerDoc.importNode(nodes[i], true));        };    } <span class="reserved">else</span> {        <span class="reserved">for</span>(var i=0;i &lt; nodes.length;i++) {            nodeTo.appendChild(nodes[i].cloneNode(true));        };    };};<span class="comment">/** * &lt;p&gt; Moves the childNodes of nodeFrom to nodeTo&lt;/p&gt; * &lt;p&gt; &lt;b&gt;Note:&lt;/b&gt; The second object's original content is deleted before  * the move operation, unless you supply a true third parameter&lt;/p&gt; * <span class="attrib">@argument</span> nodeFrom the Node to copy the childNodes from * <span class="attrib">@argument</span> nodeTo the Node to copy the childNodes to * <span class="attrib">@argument</span> bPreserveExisting whether to preserve the original content of nodeTo, default is */</span> Sarissa.moveChildNodes = <span class="reserved">function</span>(nodeFrom, nodeTo, bPreserveExisting) {    <span class="reserved">if</span>((!nodeFrom) || (!nodeTo)){        throw <span class="literal">"Both source and destination nodes must be provided"</span>;    };    <span class="reserved">if</span>(!bPreserveExisting){        Sarissa.clearChildNodes(nodeTo);    };    var nodes = nodeFrom.childNodes;    <span class="comment">// if within the same doc, just move, else copy and delete</span>    <span class="reserved">if</span>(nodeFrom.ownerDocument == nodeTo.ownerDocument){        <span class="reserved">while</span>(nodeFrom.firstChild){            nodeTo.appendChild(nodeFrom.firstChild);        };    } <span class="reserved">else</span> {        var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument;        <span class="reserved">if</span>(typeof(ownerDoc.importNode) != <span class="literal">"undefined"</span>) {           <span class="reserved">for</span>(var i=0;i &lt; nodes.length;i++) {               nodeTo.appendChild(ownerDoc.importNode(nodes[i], true));           };        }<span class="reserved">else</span>{           <span class="reserved">for</span>(var i=0;i &lt; nodes.length;i++) {               nodeTo.appendChild(nodes[i].cloneNode(true));           };        };        Sarissa.clearChildNodes(nodeFrom);    };};<span class="comment">/**  * &lt;p&gt;Serialize any object to an XML string. All properties are serialized using the property name * as the XML element name. Array elements are rendered as &lt;code&gt;array-item&lt;/code&gt; elements,  * using their index/key as the value of the &lt;code&gt;key&lt;/code&gt; attribute.&lt;/p&gt; * <span class="attrib">@argument</span> anyObject the object to serialize * <span class="attrib">@argument</span> objectName a name for that object * <span class="attrib">@return</span> the XML serializationj of the given object as a string */</span>Sarissa.xmlize = <span class="reserved">function</span>(anyObject, objectName, indentSpace){    indentSpace = indentSpace?indentSpace:<span class="literal">''</span>;    var s = indentSpace  + <span class="literal">'&lt;'</span> + objectName + <span class="literal">'&gt;'</span>;    var isLeaf = false;    <span class="reserved">if</span>(!(anyObject instanceof Object) || anyObject instanceof Number || anyObject instanceof String         || anyObject instanceof Boolean || anyObject instanceof Date){        s += Sarissa.escape(<span class="literal">""</span>+anyObject);        isLeaf = true;    }<span class="reserved">else</span>{        s += <span class="literal">"\n"</span>;        var itemKey = <span class="literal">''</span>;        var isArrayItem = anyObject instanceof Array;        <span class="reserved">for</span>(var name in anyObject){            s += Sarissa.xmlize(anyObject[name], (isArrayItem?<span class="literal">"array-item key=\"</span><span class="literal">"+name+"</span>\<span class="literal">""</span>:name), indentSpace + <span class="literal">"   "</span>);        };        s += indentSpace;    };    <span class="reserved">return</span> s += (objectName.indexOf(<span class="literal">' '</span>)!=-1?<span class="literal">"&lt;/array-item&gt;\n"</span>:<span class="literal">"&lt;/"</span> + objectName + <span class="literal">"&gt;\n"</span>);};<span class="comment">/**  * Escape the given string chacters that correspond to the five predefined XML entities * <span class="attrib">@param</span> sXml the string to escape */</span>Sarissa.escape = <span class="reserved">function</span>(sXml){    <span class="reserved">return</span> sXml.replace(/&amp;/g, <span class="literal">"&amp;amp;"</span>)        .replace(/&lt;/g, <span class="literal">"&amp;lt;"</span>)        .replace(/&gt;/g, <span class="literal">"&amp;gt;"</span>)        .replace(/<span class="literal">"/g, "</span>&amp;quot;<span class="literal">")        .replace(/'/g, "</span>&amp;apos;<span class="literal">");};/**  * Unescape the given string. This turns the occurences of the predefined XML  * entities to become the characters they represent correspond to the five predefined XML entities * @param sXml the string to unescape */Sarissa.unescape = function(sXml){    return sXml.replace(/&amp;apos;/g,"</span>'<span class="literal">")        .replace(/&amp;quot;/g,"</span>\<span class="literal">""</span>)        .replace(/&amp;gt;/g,<span class="literal">"&gt;"</span>)        .replace(/&amp;lt;/g,<span class="literal">"&lt;"</span>)        .replace(/&amp;amp;/g,<span class="literal">"&amp;"</span>);};<span class="comment">//   EOF</span></pre>	<hr><!-- ========== START OF NAVBAR ========== --><a name="navbar_top"><!-- --></a><table border="0" width="100%" cellpadding="1" cellspacing="0"><tr><td colspan=2 bgcolor="#b8cade" class="NavBarCell1"><a name="navbar_top_firstrow"><!-- --></a><table border="0" cellpadding="0" cellspacing="3">  <tr align="center" valign="top">      <td bgcolor="#b8cade" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>    <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>  <td bgcolor="#b8cade" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>  <td bgcolor="#b8cade" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>  <td bgcolor="#b8cade" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>  </tr></table></td><td bgcolor="#b8cade" align="right" valign="top"><em><b>sarissa</b></em></td></tr><tr><td bgcolor="#eeeeee" class="NavBarCell2"><font size="-2">&nbsp;PREV&nbsp;&nbsp;NEXT</font></td><td bgcolor="#eeeeee" class="NavBarCell2"><font size="-2">  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>&nbsp;&nbsp;<script>  <!--  if(window==top) {    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');  }  //--></script><noscript><a href="allclasses-noframe.html" target=""><b>All Classes</b></a></noscript></font></td></tr></table><!-- =========== END OF NAVBAR =========== --><hr><font size="-1"></font><div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Thu Nov 30 22:06:11 2006</div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -