Changeset 21008 for lang/cplusplus

Show
Ignore:
Timestamp:
10/09/08 00:24:16 (2 months ago)
Author:
tokuhirom
Message:

added elem.removeAttribute

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

Legend:

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

    r21003 r21008  
    6363END 
    6464 
     65FUNCTION(removeAttribute) 
     66    ARG_COUNT(1); 
     67    ARG_str(name, 0); 
     68    EXTERNAL_NODE(); 
     69    xmlAttrPtr attr = domGetAttrNode(node, (const xmlChar*)*name); 
     70    if (attr) { 
     71        xmlUnlinkNode((xmlNodePtr)attr); 
     72    } 
     73    return Undefined(); 
     74END 
     75 
    6576FUNCTION(setAttributeNode) 
    6677    ARG_COUNT(1); 
     
    98109    BIND_IM("getAttribute",     getAttribute); 
    99110    BIND_IM("hasAttribute",     hasAttribute); 
     111    BIND_IM("removeAttribute",  removeAttribute); 
    100112    setupNodeIM(OBJECT_TEMPLATE); 
    101113    EXPORT_CLASS("Element"); 
    102114ENDSUBMODULE 
    103115 
    104 // REST: 6/24 
     116// REST: 7/24 
    105117// TODO: elem.setAttribute 
    106118// TODO: elem.setAttributeNS 
     
    108120// TODO: elem.getAttributeNode 
    109121// TODO: elem.getAttributeNodeNS 
    110 // TODO: elem.removeAttribute 
    111122// TODO: elem.removeAttributeNS 
    112123// TODO: elem.hasAttributeNS 
  • lang/cplusplus/llv8call/trunk/t/070_libxml/02_dom.js

    r21007 r21008  
    11require('t/util.js'); 
    22 
    3 plan({tests:37}); 
     3plan({tests:39}); 
    44 
    55check_lib("org.coderepos.libxml"); 
     
    147147}); 
    148148 
     149test(function () { 
     150    root.setAttributeNode(doc.createAttribute("foo", "bar")); 
     151    is(root.toString(),  '<foo foo="bar"/>',               'doc.createAttribute()'); 
     152    root.removeAttribute("foo"); 
     153    is(root.toString(),  '<foo/>',                        'doc.createAttribute()'); 
     154}); 
     155 
    149156doc.close(); 
    150157