javascript/selenium-core/xpath/util.js
function xmlValue(node, disallowBrowserSpecificOptimization) {
  if (!node) {
    return '';
  }

  var ret = '';
  if (node.nodeType == DOM_TEXT_NODE ||
      node.nodeType == DOM_CDATA_SECTION_NODE) {
    ret += node.nodeValue;

  } else if (node.nodeType == DOM_ATTRIBUTE_NODE) {
    if (ajaxsltIsIE6) {
      ret += xmlValueIE6Hack(node);
    } else {
      ret += node.nodeValue;
    }
  } else if (node.nodeType == DOM_ELEMENT_NODE ||
             node.nodeType == DOM_DOCUMENT_NODE ||
             node.nodeType == DOM_DOCUMENT_FRAGMENT_NODE) {
    if (!disallowBrowserSpecificOptimization) {
      // IE, Safari, Opera, and friends
      var innerText = node.innerText;
      if (innerText != undefined) {
        return innerText;
      }
      // Firefox
      var textContent = node.textContent;
      if (textContent != undefined) {
        return textContent;
      }
    }
    // pobrecito!
    var len = node.childNodes.length;
    for (var i = 0; i < len; ++i) {
      ret += arguments.callee(node.childNodes[i]);
    }
  }
  return ret;
}
function xmlValue(node, disallowBrowserSpecificOptimization) {
  if (!node) {
    return '';
  }

  var ret = '';
  if (node.nodeType == DOM_TEXT_NODE ||
      node.nodeType == DOM_CDATA_SECTION_NODE) {
    ret += node.nodeValue;

  } else if (node.nodeType == DOM_ATTRIBUTE_NODE) {
    if (ajaxsltIsIE6) {
      ret += xmlValueIE6Hack(node);
    } else {
      ret += node.nodeValue;
    }
  } else if (node.nodeType == DOM_ELEMENT_NODE ||
             node.nodeType == DOM_DOCUMENT_NODE ||
             node.nodeType == DOM_DOCUMENT_FRAGMENT_NODE) {
    if (!disallowBrowserSpecificOptimization) {
      // IE, Safari, Opera, and friends
      var innerText = node.innerText;
      if (innerText != undefined) {
        return innerText;
      }
      // Firefox
      var textContent = node.textContent;
      if (textContent != undefined) {
        return textContent;
      }
    }
    // pobrecito!
    var len = node.childNodes.length;
    for (var i = 0; i < len; ++i) {
      ret += arguments.callee(node.childNodes[i]);
    }
  }
  return ret;
}
function xmlValue ( node , disallowBrowserSpecificOptimization ) { if ( ! node ) { return '' ; } var ret = '' ; if ( node . nodeType == DOM_TEXT_NODE || node . nodeType == DOM_CDATA_SECTION_NODE ) { ret += node . nodeValue ; } else if ( node . nodeType == DOM_ATTRIBUTE_NODE ) { if ( ajaxsltIsIE6 ) { ret += xmlValueIE6Hack ( node ) ; } else { ret += node . nodeValue ; } } else if ( node . nodeType == DOM_ELEMENT_NODE || node . nodeType == DOM_DOCUMENT_NODE || node . nodeType == DOM_DOCUMENT_FRAGMENT_NODE ) { if ( ! disallowBrowserSpecificOptimization ) { // IE, Safari, Opera, and friends var innerText = node . innerText ; if ( innerText != undefined ) { return innerText ; } // Firefox var textContent = node . textContent ; if ( textContent != undefined ) { return textContent ; } } // pobrecito! var len = node . childNodes . length ; for ( var i = 0 ; i < len ; ++ i ) { ret += arguments . callee ( node . childNodes [ i ] ) ; } } return ret ; }
Returns the text value of a node; for nodes without children this is the nodeValue, for nodes with children this is the concatenation of the value of all children. Browser-specific optimizations are used by default; they can be disabled by passing "true" in as the second parameter.
Returns the text value of a node ; for nodes without children this is the nodeValue for nodes with children this is the concatenation of the value of all children . Browser - specific optimizations are used by default ; they can be disabled by passing true in as the second parameter .