Thank you Siegfired!

 

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Siegfried Puchbauer
Sent:
Wednesday, July 19, 2006 3:47 AM
To: rails-spinoffs@lists.rubyonrails.org
Subject: Re: [Rails-spinoffs] collectTextNodes

 

Not tested, but should work: (It collects all textnodes, which are childs of elements with the className)

Element.collectTextNodesWithClass = function(element, className) {
    return $A($(element).childNodes).collect(function(node){
        if(node.nodeType == 3){
            return Element.hasClassName(node.parentNode, className) ?
                node.nodeValue : '';
        } else {
            return Element.hasClassName(node, className) ?
                Element.collectTextNodesWithClass(node, className) : '';
        }
    }).flatten().join('');
}

brgds, sigi


On 7/19/06, Daniel Elmore <[EMAIL PROTECTED]> wrote:

I see there is a collectTextNodesIgnoreClass method.

But who would I do the opposite: collectTextNodesWithClass

-Daniel



_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs




--
Mit freundlichen Grüßen

Siegfried Puchbauer

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to