Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>
  2.  
  3. <!--
  4.  
  5. Copyright (c) 2001-2004 World Wide Web Consortium,
  6. (Massachusetts Institute of Technology, Institut National de
  7. Recherche en Informatique et en Automatique, Keio University).  All
  8. Rights Reserved.  This program is distributed under the W3C's Software
  9. Intellectual Property License.  This program is distributed in the
  10. hope that it will be useful, but WITHOUT ANY WARRANTY; without even
  11. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12. PURPOSE.  
  13.  
  14. See W3C License http://www.w3.org/Consortium/Legal/ for more details.
  15.  
  16. -->
  17.  
  18. <!DOCTYPE test SYSTEM "dom3.dtd">
  19. <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-3" name="textreplacewholetext06">
  20. <metadata>
  21. <title>textreplacewholetext06</title>
  22. <creator>IBM</creator>
  23. <description>
  24.         The method replaceWholeText substitutes the a specified text for the text of
  25.         the current node and all logically-adjacent text nodes.  This method raises
  26.         a NO_MODIFICATION_ALLOWED_ERR if one of the Text nodes being replaced is readonly.
  27.        
  28.         Invoke replaceWholeText on an existing text node with newly created text and Entityreference
  29.         nodes (whose replacement text is a character entity reference) appended as children of its parent element node.  
  30.         Where the nodes to be removed are read-only descendants of an EntityReference, the EntityReference
  31.        must be removed instead of the read-only nodes. Only if any EntityReference to be removed has
  32.        descendants that are not EntityReference, Text, or CDATASection nodes, the replaceWholeText
  33.        method must fail, raising a NO_MODIFICATION_ALLOWED_ERR. Verify that the method does not raise
  34.        an exception and verify the content of the returned text node.
  35. </description>
  36. <contributor>Neil Delima</contributor>
  37. <date qualifier="created">2002-05-30</date>
  38. <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-replaceWholeText"/>
  39. </metadata>
  40. <implementationAttribute name="namespaceAware" value="true"/>
  41. <implementationAttribute name="expandEntityReferences" value="true"/>
  42. <var name="doc" type="Document"/>
  43. <var name="itemList" type="NodeList"/>
  44. <var name="elementStrong" type="Element"/>
  45. <var name="textNode" type="Text"/>
  46. <var name="erefNode" type="EntityReference"/>
  47. <var name="replacedText" type="Text"/>
  48. <var name="appendedChild" type="Node"/>
  49. <var name="nodeValue" type="DOMString"/>
  50.  
  51.  
  52.  
  53. <load var="doc" href="hc_staff" willBeModified="false"/>
  54.  
  55.  
  56.  
  57. <getElementsByTagName var="itemList" obj="doc" tagname='"strong"' interface="Document"/>
  58. <item var="elementStrong" obj="itemList" index="0" interface="NodeList"/>
  59. <createTextNode var="textNode" obj="doc" data='"New Text"'/>
  60. <createEntityReference var="erefNode" obj="doc" name='"beta"'/>
  61. <appendChild obj="elementStrong" var="appendedChild" newChild="textNode"/>
  62. <appendChild obj="elementStrong" var="appendedChild" newChild="erefNode"/>
  63. <firstChild var="textNode" obj="elementStrong" interface="Node"/>
  64. <replaceWholeText obj="textNode" var="replacedText" content='"New Text and Cdata"'/>
  65. <nodeValue var="nodeValue" obj="textNode" />
  66. <assertEquals actual="nodeValue" expected='"New Text and Cdata"' id="textreplacewholetext06" ignoreCase="false"/>
  67. </test>
  68.