Changeset 20988
- Timestamp:
- 10/08/08 23:28:16 (3 months ago)
- Location:
- lang/cplusplus/llv8call/trunk
- Files:
-
- 2 modified
-
ext/libxml/element.cc (modified) (3 diffs)
-
t/070_libxml/02_dom.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/cplusplus/llv8call/trunk/ext/libxml/element.cc
r20986 r20988 30 30 xmlNodeAddContent(node, (const xmlChar*)*content); 31 31 return Undefined(); 32 END 33 34 FUNCTION(getAttribute) 35 ARG_COUNT(1); 36 ARG_str(name, 0); 37 EXTERNAL_NODE(); 38 xmlChar* ret = xmlGetNoNsProp(node, (xmlChar*)*name); 39 if (ret) { 40 Handle<String> s = String::New((const char*)ret); 41 xmlFree(ret); 42 return s; 43 } else { 44 return Undefined(); 45 } 32 46 END 33 47 … … 65 79 BIND_IM("appendText", appendText); 66 80 BIND_IM("appendTextNode", appendText); // alias 81 BIND_IM("getAttribute", getAttribute); 67 82 setupNodeIM(OBJECT_TEMPLATE); 68 83 EXPORT_CLASS("Element"); … … 73 88 // TODO: elem.setAttribute 74 89 // TODO: elem.setAttributeNS 75 // TODO: elem.getAttribute76 90 // TODO: elem.getAttributeNS 77 91 // TODO: elem.getAttributeNode -
lang/cplusplus/llv8call/trunk/t/070_libxml/02_dom.js
r20949 r20988 1 1 require('t/util.js'); 2 2 3 plan({tests:2 3});3 plan({tests:25}); 4 4 5 5 check_lib("org.coderepos.libxml"); … … 101 101 is(root.toString(), '<foo foo="baz"/>', 'doc.createAttribute()'); 102 102 is(attr.getOwnerElement().toString(), root.toString(), "attr.getOwnerElement"); 103 is(root.getAttribute("foo"), 'baz', 'node.getAttribute()'); 104 is(root.getAttribute("notfound"), undefined, 'node.getAttribute()'); 103 105 }); 104 106
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)