Changeset 15133 in webkit for trunk/JavaScriptCore/API/minidom.js
- Timestamp:
- Jul 1, 2006, 9:06:07 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/minidom.js
r14951 r15133 26 26 27 27 // For browser-based testing 28 if ( window) {28 if (typeof window != 'undefined') { 29 29 /* 30 30 The methods and constructors below approximate what that the native host should provide … … 60 60 } 61 61 62 Node.prototype. tag= "Node";62 Node.prototype.nodeType = "Node"; 63 63 64 64 Node.prototype.appendChild = function(child) { … … 74 74 75 75 printSpaces(numSpaces); 76 print('<' + this. tag+ '>' + '\n');76 print('<' + this.nodeType + '>' + '\n'); 77 77 78 78 var childNodesLength = this.childNodes.length; … … 81 81 82 82 printSpaces(numSpaces); 83 print('</' + this. tag+ '>\n');83 print('</' + this.nodeType + '>\n'); 84 84 } 85 85 … … 91 91 TextNode.prototype = new Node(); 92 92 93 TextNode.prototype. tag= "Text";93 TextNode.prototype.nodeType = "Text"; 94 94 95 95 TextNode.prototype.serialize = function(numSpaces) { … … 105 105 Element.prototype = new Node(); 106 106 107 Element.prototype. tag= "Element";107 Element.prototype.nodeType = "Element"; 108 108 109 109 RootElement = function() … … 113 113 RootElement.prototype = new Element(); 114 114 115 RootElement.prototype. tag= "Root";115 RootElement.prototype.nodeType = "Root"; 116 116 117 117 HeroElement = function() … … 121 121 HeroElement.prototype = new Element(); 122 122 123 HeroElement.prototype. tag= "Hero";123 HeroElement.prototype.nodeType = "Hero"; 124 124 125 125 VillainElement = function() … … 129 129 VillainElement.prototype = new Element(); 130 130 131 VillainElement.prototype. tag= "Villain";131 VillainElement.prototype.nodeType = "Villain"; 132 132 133 133 NameElement = function() … … 137 137 NameElement.prototype = new Element(); 138 138 139 NameElement.prototype. tag= "Name";139 NameElement.prototype.nodeType = "Name"; 140 140 141 141 WeaponElement = function() … … 145 145 WeaponElement.prototype = new Element(); 146 146 147 WeaponElement.prototype. tag= "Weapon";147 WeaponElement.prototype.nodeType = "Weapon"; 148 148 149 149 Document = function() … … 168 168 function test() 169 169 { 170 print("Node is " + Node); 171 for (var p in Node) 172 print(p + ": " + Node[p]); 173 174 node = new Node(); 175 print("node is " + node); 176 for (var p in node) 177 print(p + ": " + node[p]); 178 179 child1 = new Node(); 180 child2 = new Node(); 181 child3 = new Node(); 182 183 node.appendChild(child1); 184 node.appendChild(child2); 185 186 for (var i = 0; i < node.childNodes.length + 1; i++) { 187 print("item " + i + ": " + node.childNodes.item(i)); 188 } 189 190 for (var i = 0; i < node.childNodes.length + 1; i++) { 191 print(i + ": " + node.childNodes[i]); 192 } 193 194 node.removeChild(child1); 195 node.replaceChild(child3, child2); 196 197 for (var i = 0; i < node.childNodes.length + 1; i++) { 198 print("item " + i + ": " + node.childNodes.item(i)); 199 } 200 201 for (var i = 0; i < node.childNodes.length + 1; i++) { 202 print(i + ": " + node.childNodes[i]); 203 } 204 205 try { 206 node.appendChild(null); 207 } catch(e) { 208 print("caught: " + e); 209 } 210 211 try { 212 var o = new Object(); 213 o.appendChild = node.appendChild; 214 o.appendChild(node); 215 } catch(e) { 216 print("caught: " + e); 217 } 218 219 try { 220 node.appendChild(); 221 } catch(e) { 222 print("caught: " + e); 223 } 224 225 /* 170 226 var element, name, weapon; 171 227 … … 173 229 document.appendChild(document.createElement('Root')); 174 230 175 / * Tank Girl */231 // Tank Girl 176 232 element = document.createElement('Hero'); 177 233 … … 195 251 196 252 197 / * Skeletor */253 // Skeletor 198 254 element = document.createElement('Villain'); 199 255 … … 212 268 document.firstChild.appendChild(element); 213 269 214 / * Serialize */270 // Serialize 215 271 document.serialize(); 272 */ 216 273 } 274 275 test();
Note:
See TracChangeset
for help on using the changeset viewer.