function (elem)
    {
        if (!elem) { return null; }

        var str = "";
        if (elem.childNodes.length === 0 && elem.nodeType ==
            Strophe.ElementType.TEXT) {
            str += elem.nodeValue;
        }

        for (var i = 0; i < elem.childNodes.length; i++) {
            if (elem.childNodes[i].nodeType == Strophe.ElementType.TEXT) {
                str += elem.childNodes[i].nodeValue;
            }
        }

        return Strophe.xmlescape(str);
    }
function (elem)
    {
        if (!elem) { return null; }

        var str = "";
        if (elem.childNodes.length === 0 && elem.nodeType ==
            Strophe.ElementType.TEXT) {
            str += elem.nodeValue;
        }

        for (var i = 0; i < elem.childNodes.length; i++) {
            if (elem.childNodes[i].nodeType == Strophe.ElementType.TEXT) {
                str += elem.childNodes[i].nodeValue;
            }
        }

        return Strophe.xmlescape(str);
    }
function ( elem ) { if ( ! elem ) { return null ; } var str = "" ; if ( elem . childNodes . length === 0 && elem . nodeType == Strophe . ElementType . TEXT ) { str += elem . nodeValue ; } for ( var i = 0 ; i < elem . childNodes . length ; i ++ ) { if ( elem . childNodes [ i ] . nodeType == Strophe . ElementType . TEXT ) { str += elem . childNodes [ i ] . nodeValue ; } } return Strophe . xmlescape ( str ) ; }
Function: getText
Get the concatenation of all text children of an element.

Parameters:
(XMLElement) elem - A DOM element.

Returns:
A String with the concatenated text of all text element children.
Function : getText Get the concatenation of all text children of an element .
Returns the text of the last tag in the sequence