Changeset 21002
- Timestamp:
- 10/09/08 00:04:42 (3 months ago)
- Location:
- lang/cplusplus/llv8call/trunk
- Files:
-
- 4 modified
-
ext/libxml/document.cc (modified) (3 diffs)
-
ext/libxml/node.cc (modified) (1 diff)
-
ext/libxml/node.h (modified) (2 diffs)
-
t/070_libxml/02_dom.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/cplusplus/llv8call/trunk/ext/libxml/document.cc
r20986 r21002 71 71 END 72 72 73 FUNCTION( _documentElement)73 FUNCTION(documentElement) 74 74 ARG_COUNT(0); 75 75 EXTERNAL_DOC(); … … 191 191 BIND_IM("setEncoding", setEncoding); 192 192 BIND_IM("version", _version); 193 BIND_IM("documentElement", _documentElement);193 BIND_IM("documentElement", documentElement); 194 194 BIND_IM("setDocumentElement", setDocumentElement); 195 195 BIND_IM("createElement", createElement); … … 222 222 // TODO: doc.is_valid 223 223 // TODO: doc.validate 224 // TODO: doc.documentElement225 224 // TODO: doc.createElementNS 226 225 // TODO: doc.createAttributeNS -
lang/cplusplus/llv8call/trunk/ext/libxml/node.cc
r20999 r21002 35 35 ENDSUBMODULE 36 36 37 // REST: 1 3/5037 // REST: 14/50 38 38 39 // TODO: node.setNodeName40 39 // TODO: node.isSameNode 41 40 // TODO: node.isEqual -
lang/cplusplus/llv8call/trunk/ext/libxml/node.h
r20999 r21002 17 17 EXTERNAL_NODE(); 18 18 return String::New((char*)domName(node)); 19 END 20 21 FUNCTION(setNodeName) 22 ARG_COUNT(1); 23 ARG_str(name, 0); 24 EXTERNAL_NODE(); 25 xmlNodeSetName(node, (const xmlChar*)*name); 26 return Undefined(); 19 27 END 20 28 … … 214 222 static inline void setupNodeIM(Handle<ObjectTemplate> OBJECT_TEMPLATE) { 215 223 BIND_IM("nodeName", nodeName); 224 BIND_IM("setNodeName", setNodeName); 216 225 BIND_IM("toString", toString); 217 226 BIND_IM("appendChild", appendChild); -
lang/cplusplus/llv8call/trunk/t/070_libxml/02_dom.js
r20999 r21002 1 1 require('t/util.js'); 2 2 3 plan({tests:3 1});3 plan({tests:32}); 4 4 5 5 check_lib("org.coderepos.libxml"); 6 6 var libxml = org.coderepos.libxml; 7 7 8 var doc = new libxml.Document.createDocument("1.0"); 9 var foo = doc.createElement("foo"); 10 doc.setDocumentElement(foo); 11 var root = doc.documentElement(); 12 var bar = doc.createElement("bar"); 13 var eee = doc.createElement("eee"); 8 var doc; 9 var foo; 10 var root; 11 var bar; 12 var eee; 14 13 15 14 function test(cb, purpose) { 16 root.removeChildNodes(); 15 doc = new libxml.Document.createDocument("1.0"); 16 foo = doc.createElement("foo"); 17 doc.setDocumentElement(foo); 18 root = doc.documentElement(); 19 bar = doc.createElement("bar"); 20 eee = doc.createElement("eee"); 17 21 cb(); 18 22 } … … 21 25 root.appendChild(bar); 22 26 is(root.toString(), "<foo><bar/></foo>", "node.appendChild"); 27 }); 28 29 test(function () { 30 root.setNodeName("yay"); 31 is(root.toString(), "<yay/>", "node.setNodeName"); 23 32 }); 24 33 … … 109 118 var cdata = doc.createCDATASection("foo"); 110 119 root.appendChild(cdata); 111 is(root.toString(), '<foo foo="baz"><![CDATA[foo]]></foo>', 'doc.createCDATASection()');120 is(root.toString(), '<foo><![CDATA[foo]]></foo>', 'doc.createCDATASection()'); 112 121 }); 113 122 … … 119 128 root.appendChild(f2); 120 129 root.appendChild(f3); 121 is(root.toString(), '<foo foo="baz"><f1/><f2/><f3/></foo>','doc.nextSibling()');130 is(root.toString(), '<foo><f1/><f2/><f3/></foo>', 'doc.nextSibling()'); 122 131 is(f2.nextSibling().nodeName(), 'f3', 'doc.nextSibling()'); 123 132 is(f3.nextSibling(), undefined, 'doc.nextSibling()');
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)