content/test/unit/test_delete_range.xml

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <!--
     3 This file holds serialized tests for DOM Range tests on extractContents.
     4 The <test/> elements designate individual tests.  Each one has the following:
     6 * A <source/> element, designating the start conditions of the test,
     7 * A <result/> element, designating what the source element should look like
     8   after the extraction,
     9 * An <extract/> element, designating what the extracted content should look like.
    11 The <split/> element designates a split between two DOM nodes. This element will
    12 be removed before the actual test, and the two nodes on either side will not be
    13 merged.
    15 The <empty-cdata/> element designates an empty character data section.  Before
    16 the test executes, this element is replaced with an actual CDATASection node.
    18 For the <source/> element, there are four attributes:
    20 * startContainer:  A XPath to the startContainer of the range.
    21 * endContainer:  A XPath to the endContainer of the range.
    22 * startOffset:  The startOffset of the range.
    23 * endOffset:  The endOffset of the range.
    25 Note this test may need updating with a fix for bug 401276.  The spec states
    26 adjacent nodes after an extraction should be merged if possible, but using the
    27 normalize() method, which could have unintended side effects... For now, we're
    28 not permitting that, pending clarification.
    30 Please make sure the first test in this document always tests a range where the
    31 start container and end container are the same text node, and where the start
    32 offset and end offsets are valid and inequal.  Some of the additional range
    33 tests (after the bulk of the delete/extract tests) depend on it.
    34   -->
    35 <root>
    36   <!-- Extracting from a text node. -->
    37   <test>
    38     <source startContainer="text()[1]"
    39             endContainer="text()[1]"
    40             startOffset="4"
    41             endOffset="10">The quick fox</source>
    42     <result>The fox</result>
    43     <extract>quick </extract>
    44   </test>
    46   <!-- Extracting from a CDATA section. -->
    47   <test>
    48     <source startContainer="text()[1]"
    49             endContainer="text()[1]"
    50             startOffset="4"
    51             endOffset="10"><![CDATA[The quick fox]]></source>
    52     <result><![CDATA[The fox]]></result>
    53     <extract><![CDATA[quick ]]></extract>
    54   </test>
    56   <!-- Snipping the start of a text node. -->
    57   <test>
    58     <source startContainer="text()[1]"
    59             endContainer="text()[1]"
    60             startOffset="0"
    61             endOffset="4"><![CDATA[The quick fox]]></source>
    62     <result><![CDATA[quick fox]]></result>
    63     <extract><![CDATA[The ]]></extract>
    64   </test>
    66   <!-- Extracting from a comment. -->
    67   <test>
    68     <source startContainer="comment()[1]"
    69             endContainer="comment()[1]"
    70             startOffset="4"
    71             endOffset="10"><!--The quick fox--></source>
    72     <result><!--The fox--></result>
    73     <extract><!--quick --></extract>
    74   </test>
    76   <!-- Snipping whole nodes -->
    77   <test>
    78     <source startContainer="."
    79             endContainer="."
    80             startOffset="0"
    81             endOffset="2">Fox<fox/>Fox<bear/><!--comment--></source>
    82     <result>Fox<bear/><!--comment--></result>
    83     <extract>Fox<fox/></extract>
    84   </test>
    86   <!-- Snipping whole nodes -->
    87   <test>
    88     <source startContainer="."
    89             endContainer="."
    90             startOffset="1"
    91             endOffset="3">Fox<fox/>Fox<bear/><!--comment--></source>
    92     <result>Fox<bear/><!--comment--></result>
    93     <extract><fox/>Fox</extract>
    94   </test>
    96   <!-- Snipping a mixture of nodes and portions of text -->
    97   <test>
    98     <source startContainer="text()[2]"
    99             startOffset="1"
   100             endContainer="comment()[1]"
   101             endOffset="3">Fox<fox/>Fox<bear><?cow ?></bear><!--comment--></source>
   102     <result>Fox<fox/>F<!--ment--></result>
   103     <extract>ox<bear><?cow ?></bear><!--com--></extract>
   104   </test>
   106   <!-- Extracting with a collapsed range from a text node. -->
   107   <test>
   108     <source startContainer="text()[1]"
   109             endContainer="text()[1]"
   110             startOffset="4"
   111             endOffset="4">The quick fox</source>
   112     <result>The quick fox</result>
   113     <extract/>
   114   </test>
   116   <!-- Extracting with a collapsed range from a non-text node. -->
   117   <test>
   118     <source startContainer="."
   119             endContainer="."
   120             startOffset="0"
   121             endOffset="0">Fox<fox/>Fox<bear/><!--comment--></source>
   122     <result>Fox<fox/>Fox<bear/><!--comment--></result>
   123     <extract/>
   124   </test>
   125 </root>

mercurial