third_party/js/mozmill/shared-modules/dom-utils.js
function DOMWalker__walk(root) {
    if (!root.childNodes)
      throw new Error("root.childNodes does not exist");

    var collectedResults = [];

    for (var i = 0; i < root.childNodes.length; i++) {
      var nodeStatus = this._callbackFilter(root.childNodes[i]);

      var nodeTestResults = [];

      switch (nodeStatus) {
        case DOMWalker.FILTER_ACCEPT:
          nodeTestResults = this._callbackNodeTest(root.childNodes[i]);
          collectedResults = collectedResults.concat(nodeTestResults);
          // no break here as we have to perform the _walk below too
        case DOMWalker.FILTER_SKIP:
          nodeTestResults = this._walk(root.childNodes[i]);
          break;
        default:
          break;
      }

      collectedResults = collectedResults.concat(nodeTestResults);
    }
    return collectedResults;
  }
function DOMWalker__walk(root) {
    if (!root.childNodes)
      throw new Error("root.childNodes does not exist");

    var collectedResults = [];

    for (var i = 0; i < root.childNodes.length; i++) {
      var nodeStatus = this._callbackFilter(root.childNodes[i]);

      var nodeTestResults = [];

      switch (nodeStatus) {
        case DOMWalker.FILTER_ACCEPT:
          nodeTestResults = this._callbackNodeTest(root.childNodes[i]);
          collectedResults = collectedResults.concat(nodeTestResults);
          // no break here as we have to perform the _walk below too
        case DOMWalker.FILTER_SKIP:
          nodeTestResults = this._walk(root.childNodes[i]);
          break;
        default:
          break;
      }

      collectedResults = collectedResults.concat(nodeTestResults);
    }
    return collectedResults;
  }
function DOMWalker__walk ( root ) { if ( ! root . childNodes ) throw new Error ( "root.childNodes does not exist" ) ; var collectedResults = [ ] ; for ( var i = 0 ; i < root . childNodes . length ; i ++ ) { var nodeStatus = this . _callbackFilter ( root . childNodes [ i ] ) ; var nodeTestResults = [ ] ; switch ( nodeStatus ) { case DOMWalker . FILTER_ACCEPT : nodeTestResults = this . _callbackNodeTest ( root . childNodes [ i ] ) ; collectedResults = collectedResults . concat ( nodeTestResults ) ; // no break here as we have to perform the _walk below too case DOMWalker . FILTER_SKIP : nodeTestResults = this . _walk ( root . childNodes [ i ] ) ; break ; default : break ; } collectedResults = collectedResults . concat ( nodeTestResults ) ; } return collectedResults ; }
DOMWalker_walk goes recursively through the DOM, starting with a provided
root-node.

First, it filters nodes by submitting each node to the this._callbackFilter
method to decide, if a node should be submitted to a provided
this._callbackNodeTest method to test (that hapens in case of
FILTER_ACCEPT).
In case of FILTER_ACCEPT and FILTER_SKIP, the children of such a node
will be filtered recursively.
Nodes with the nodeStatus "FILTER_REJECT" and their descendants will be
completetly ignored.

@param {Node} root
Node to start testing from
[optional - default: this._controller.window.document.documentElement]
@returns An array with gathered all results from testing a given element
@type {array of elements}
DOMWalker_walk goes recursively through the DOM starting with a provided root - node .