text->mValue.SetCapacity(mTextLength + 1); text->mValue.Append(mText, mTextLength); text->mValue.Trim(" \t\n\r");
text->mValue.Assign(mText, mTextLength); if (stripWhitespace) text->mValue.Trim(" \t\n\r");
XULContentSinkImpl::FlushText(PRBool aCreateTextNode){    nsresult rv;    do {        // Don't do anything if there's no text to create a node from, or        // if they've told us not to create a text node        if (! mTextLength)            break;        if (! aCreateTextNode)            break;        // Don't bother if there's nothing but whitespace.        // XXX This could cause problems...        if (! IsDataInBuffer(mText, mTextLength))            break;        // Don't bother if we're not in XUL document body        if (mState != eInDocumentElement || mContextStack.Depth() == 0)            break;        // Trim the leading and trailing whitespace        nsXULPrototypeText* text = new nsXULPrototypeText();        if (! text)            return NS_ERROR_OUT_OF_MEMORY;        text->mValue.SetCapacity(mTextLength + 1);        text->mValue.Append(mText, mTextLength);        text->mValue.Trim(" \t\n\r");        // hook it up        nsVoidArray* children;        rv = mContextStack.GetTopChildren(&children);        if (NS_FAILED(rv)) return rv;        // transfer ownership of 'text' to the children array        children->AppendElement(text);    } while (0);    // Reset our text buffer    mTextLength = 0;    return NS_OK;}