Changeset 53

Show
Ignore:
Timestamp:
01/21/12 07:40:52 (4 months ago)
Author:
Michael Rynn
Message:

Ticket #8 getTextContent should not return text content of ProcessingInstruction? or Comment nodes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/std/xmlp/linkdom.d

    r52 r53  
    17581758    ChildNode lastChild_; 
    17591759 
     1760    /// Remove all links at once. Let the GC sort this out! 
     1761    void removeAll() 
     1762    { 
     1763        firstChild_ = null; 
     1764        lastChild_ = null; 
     1765    } 
     1766 
    17601767    /// remove 
    17611768    void removeLink(ChildNode ch) 
     
    21842191        return result; 
    21852192    } 
    2186     /// method 
     2193    /// Brutal replacement of all children with single text node 
     2194    override void setTextContent(DOMString txt) 
     2195    { 
     2196        children_.removeAll(); 
     2197        if (txt.length > 0) 
     2198            appendChild(new Text(txt)); 
     2199    } 
     2200    ///Recursive on Text-like data.  Has no implementation of isTextNodeWhiteSpace 
    21872201    override const DOMString getTextContent() 
    21882202    { 
     
    21982212            switch(n.getNodeType()) 
    21992213            { 
    2200             case NodeType.Processing_Instruction_node: 
     2214                //case NodeType.Comment_node://  
     2215                //case NodeType.Processing_Instruction_node: 
    22012216            case NodeType.CDATA_Section_node: 
    2202             case NodeType.Comment_node: 
    22032217            case NodeType.Text_node: 
    2204                 app.put(n.getNodeValue()); 
    2205                 break; 
    22062218            case NodeType.Element_node: 
    22072219                app.put(n.getTextContent()); 
     
    22352247        } 
    22362248    } 
    2237  
     2249     
     2250    /// This is none-DOM, put in because std.xml had it 
    22382251    @property const DOMString text() 
    22392252    { 
     
    26152628        id_ = text(id_[0..offset], s, id_[offset+count..$]); 
    26162629    } 
    2617  
     2630    /// Has text, so get it 
     2631    override DOMString getTextContent() 
     2632    { 
     2633        return id_; 
     2634    } 
     2635    /// Takes text, so set it 
     2636    override void setTextContent(DOMString txt) 
     2637    { 
     2638        id_ = txt; 
     2639    } 
    26182640 
    26192641};