Changeset 20882

Show
Ignore:
Timestamp:
10/07/08 09:32:10 (6 weeks ago)
Author:
tokuhirom
Message:

added elem.appendText

Location:
lang/cplusplus/llv8call/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/cplusplus/llv8call/trunk/ext/libxml/element.cc

    r20881 r20882  
    2222 
    2323#include "node.h" 
     24 
     25// doc.appendText('foo') 
     26FUNCTION(appendText) 
     27    ARG_COUNT(1); 
     28    ARG_str(content, 0); 
     29    EXTERNAL_NODE(); 
     30    xmlNodeAddContent(node, (const xmlChar*)*content); 
     31    return Undefined(); 
     32END 
    2433 
    2534FUNCTION(setAttributeNode) 
     
    5362SUBMODULE(init_elem) 
    5463    CLASS_WITH_CONSTRUCTOR(_new); 
    55     puts("HEM"); 
    5664    BIND_IM("setAttributeNode", setAttributeNode); 
     65    BIND_IM("appendText",       appendText); 
     66    BIND_IM("appendTextNode",   appendText); // alias 
    5767    setupNodeIM(OBJECT_TEMPLATE); 
    5868    EXPORT_CLASS("Element"); 
    5969ENDSUBMODULE 
    6070 
    61 // REST: 0/24 
     71// REST: 3/24 
    6272// TODO: elem.new 
    6373// TODO: elem.setAttribute 
     
    7888// TODO: elem.getElementsByLocalName 
    7989// TODO: elem.appendWellBalancedChunk 
    80 // TODO: elem.appendText 
    81 // TODO: elem.appendTextNode 
    8290// TODO: elem.appendTextChild 
    8391// TODO: elem.setNamespace 
  • lang/cplusplus/llv8call/trunk/t/070_libxml/02_dom.js

    r20881 r20882  
    11require('t/util.js'); 
    22 
    3 plan({tests:17}); 
     3plan({tests:19}); 
    44 
    55check_lib("org.coderepos.libxml"); 
     
    8989 
    9090test(function () { 
     91    root.appendTextNode("AAAA"); 
     92    is(root.toString(),  '<foo>AAAA</foo>', 'node.appendTextNode()'); 
     93}); 
     94 
     95test(function () { 
    9196    root.setAttributeNode(doc.createAttribute("foo", "bar")); 
    9297    is(root.toString(),  '<foo foo="bar"/>', 'node.createAttribute()');