Home | History | Annotate | Download | only in Attr
      1 Test that different ways of changing an element's id all work properly.
      2 
      3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
      4 
      5 
      6 
      7 1. Check id after parsing.
      8 PASS document.getElementById("a") is document.body
      9 PASS document.body.id is "a"
     10 PASS document.body.getAttributeNode("id").isId is true
     11 PASS document.body.getAttributeNode("id").textContent is "a"
     12 
     13 2. Change Attr.value.
     14 PASS document.getElementById("a") is null
     15 PASS document.getElementById("b") is document.body
     16 PASS document.body.getAttributeNode("id").textContent is "b"
     17 
     18 3. Change HTMLElement.id.
     19 PASS document.getElementById("b") is null
     20 PASS document.getElementById("c") is document.body
     21 PASS document.body.getAttributeNode("id").textContent is "c"
     22 
     23 4. Change id attribute via setAttribute().
     24 PASS document.getElementById("c") is null
     25 PASS document.getElementById("d") is document.body
     26 PASS document.body.getAttributeNode("id").textContent is "d"
     27 
     28 5. Change id attribute via setAttributeNS().
     29 PASS document.getElementById("d") is null
     30 PASS document.getElementById("e") is document.body
     31 PASS document.body.getAttributeNode("id").textContent is "e"
     32 
     33 6. Change Attr.nodeValue.
     34 PASS document.getElementById("e") is null
     35 PASS document.getElementById("f") is document.body
     36 PASS document.body.id is "f"
     37 PASS document.body.getAttribute("id") is "f"
     38 PASS attrNode.textContent is "f"
     39 PASS attrNode.childNodes.length is 1
     40 
     41 7. Attr.replaceChild().
     42 PASS document.getElementById("f") is null
     43 PASS document.getElementById("g") is document.body
     44 PASS document.body.id is "g"
     45 PASS document.body.getAttribute("id") is "g"
     46 PASS attrNode.textContent is "g"
     47 PASS attrNode.childNodes.length is 1
     48 
     49 8. Attr.insertBefore().
     50 PASS document.getElementById("g") is null
     51 PASS document.getElementById("0g") is document.body
     52 PASS document.body.id is "0g"
     53 PASS document.body.getAttribute("id") is "0g"
     54 PASS attrNode.textContent is "0g"
     55 PASS attrNode.childNodes.length is 2
     56 
     57 9. attr.appendChild().
     58 PASS document.getElementById("0g") is null
     59 PASS document.getElementById("0g2") is document.body
     60 PASS document.body.id is "0g2"
     61 PASS document.body.getAttribute("id") is "0g2"
     62 PASS attrNode.textContent is "0g2"
     63 PASS attrNode.childNodes.length is 3
     64 
     65 10. Attr.removeChild()
     66 PASS document.body.getAttributeNode("id").childNodes.length is 0
     67 PASS document.getElementById("h") is null
     68 PASS document.getElementById("") is null
     69 PASS document.body.id is ""
     70 PASS document.body.getAttribute("id") is ""
     71 PASS document.body.getAttributeNode("id").textContent is ""
     72 
     73 11. Changing Text.nodeValue.
     74 PASS attrNode.firstChild.nodeValue is "i"
     75 PASS document.getElementById("i") is document.body
     76 PASS document.body.id is "i"
     77 PASS document.body.getAttribute("id") is "i"
     78 PASS attrNode.textContent is "i"
     79 PASS attrNode.childNodes.length is 1
     80 
     81 12. Chnaging Attr.textContent.
     82 PASS document.getElementById("i") is null
     83 PASS document.getElementById("hi") is document.body
     84 PASS document.body.id is "hi"
     85 PASS document.body.getAttribute("id") is "hi"
     86 PASS attrNode.textContent is "hi"
     87 PASS attrNode.childNodes.length is 1
     88 
     89 13. Text.splitText().
     90 PASS document.getElementById("hi") is document.body
     91 PASS document.body.id is "hi"
     92 PASS document.body.getAttribute("id") is "hi"
     93 PASS document.body.getAttributeNode("id").textContent is "hi"
     94 PASS document.body.getAttributeNode("id").childNodes.length is 2
     95 
     96 14. Node.normalize(), joining text nodes.
     97 PASS document.getElementById("hi") is document.body
     98 PASS document.body.id is "hi"
     99 PASS document.body.getAttribute("id") is "hi"
    100 PASS document.body.getAttributeNode("id").textContent is "hi"
    101 PASS document.body.getAttributeNode("id").childNodes.length is 1
    102 
    103 15. Changing Attr.nodeValue.
    104 PASS document.getElementById("hi") is null
    105 PASS document.getElementById("j") is document.body
    106 PASS document.body.id is "j"
    107 PASS document.body.getAttribute("id") is "j"
    108 PASS attrNode.textContent is "j"
    109 PASS attrNode.childNodes.length is 1
    110 
    111 16. Changing Text.data.
    112 PASS document.getElementById("j") is null
    113 PASS document.getElementById("k") is document.body
    114 PASS document.body.id is "k"
    115 PASS document.body.getAttribute("id") is "k"
    116 PASS attrNode.textContent is "k"
    117 PASS attrNode.childNodes.length is 1
    118 
    119 17. Changing text child with appendData().
    120 PASS document.getElementById("k") is null
    121 PASS document.getElementById("kl") is document.body
    122 PASS document.body.id is "kl"
    123 PASS document.body.getAttribute("id") is "kl"
    124 PASS attrNode.textContent is "kl"
    125 PASS attrNode.childNodes.length is 1
    126 
    127 18. Changing text child with insertData().
    128 PASS document.getElementById("kl") is null
    129 PASS document.getElementById("k1l") is document.body
    130 PASS document.body.id is "k1l"
    131 PASS document.body.getAttribute("id") is "k1l"
    132 PASS attrNode.textContent is "k1l"
    133 PASS attrNode.childNodes.length is 1
    134 
    135 19. Changing text child with deleteData().
    136 PASS document.getElementById("k1l") is null
    137 PASS document.getElementById("l") is document.body
    138 PASS document.body.id is "l"
    139 PASS document.body.getAttribute("id") is "l"
    140 PASS attrNode.textContent is "l"
    141 PASS attrNode.childNodes.length is 1
    142 
    143 20. Changing text child with replaceData().
    144 PASS document.getElementById("l") is null
    145 PASS document.getElementById("mn") is document.body
    146 PASS document.body.id is "mn"
    147 PASS document.body.getAttribute("id") is "mn"
    148 PASS attrNode.textContent is "mn"
    149 PASS attrNode.childNodes.length is 1
    150 
    151 21. Remove an Attr node.
    152 PASS document.body.id is ""
    153 PASS document.getElementById("mn") is null
    154 PASS document.body.getAttribute("id") is null
    155 PASS document.body.getAttributeNode("id") is null
    156 
    157 22. Add an Attr node.
    158 PASS document.getElementById("o") is document.body
    159 PASS document.body.id is "o"
    160 PASS document.body.getAttribute("id") is "o"
    161 
    162 23. Add an Attr node over an existing one.
    163 PASS document.getElementById("o") is null
    164 PASS document.getElementById("p") is document.body
    165 PASS document.body.id is "p"
    166 PASS document.body.getAttribute("id") is "p"
    167 PASS successfullyParsed is true
    168 
    169 TEST COMPLETE
    170 
    171