3p/closure-library-20130212/third_party/closure/goog/dojo/dom/query.js
function(query, root) {
    // NOTE: elementsById is not currently supported
    // NOTE: ignores xpath-ish queries for now

    //Set list constructor to desired value. This can change
    //between calls, so always re-assign here.

    if (!query) {
      return [];
    }

    if (query.constructor == Array) {
      return /** @type {!Array} */ (query);
    }

    if (!goog.isString(query)) {
      return [query];
    }

    if (goog.isString(root)) {
      root = goog.dom.getElement(root);
      if (!root) {
        return [];
      }
    }

    root = root || goog.dom.getDocument();
    var od = root.ownerDocument || root.documentElement;

    // throw the big case sensitivity switch

    // NOTE:
    //    Opera in XHTML mode doesn't detect case-sensitivity correctly
    //    and it's not clear that there's any way to test for it
    caseSensitive =
        root.contentType && root.contentType == 'application/xml' ||
        goog.userAgent.OPERA &&
          (root.doctype || od.toString() == '[object XMLDocument]') ||
        !!od &&
        (goog.userAgent.IE ? od.xml : (root.xmlVersion || od.xmlVersion));

    // NOTE:
    //    adding 'true' as the 2nd argument to getQueryFunc is useful for
    //    testing the DOM branch without worrying about the
    //    behavior/performance of the QSA branch.
    var r = getQueryFunc(query)(root);

    // FIXME(slightlyoff):
    //    need to investigate this branch WRT dojo:#8074 and dojo:#8075
    if (r && r.nozip) {
      return r;
    }
    return _zip(r);
  }
function(query, root) {
    // NOTE: elementsById is not currently supported
    // NOTE: ignores xpath-ish queries for now

    //Set list constructor to desired value. This can change
    //between calls, so always re-assign here.

    if (!query) {
      return [];
    }

    if (query.constructor == Array) {
      return /** @type {!Array} */ (query);
    }

    if (!goog.isString(query)) {
      return [query];
    }

    if (goog.isString(root)) {
      root = goog.dom.getElement(root);
      if (!root) {
        return [];
      }
    }

    root = root || goog.dom.getDocument();
    var od = root.ownerDocument || root.documentElement;

    // throw the big case sensitivity switch

    // NOTE:
    //    Opera in XHTML mode doesn't detect case-sensitivity correctly
    //    and it's not clear that there's any way to test for it
    caseSensitive =
        root.contentType && root.contentType == 'application/xml' ||
        goog.userAgent.OPERA &&
          (root.doctype || od.toString() == '[object XMLDocument]') ||
        !!od &&
        (goog.userAgent.IE ? od.xml : (root.xmlVersion || od.xmlVersion));

    // NOTE:
    //    adding 'true' as the 2nd argument to getQueryFunc is useful for
    //    testing the DOM branch without worrying about the
    //    behavior/performance of the QSA branch.
    var r = getQueryFunc(query)(root);

    // FIXME(slightlyoff):
    //    need to investigate this branch WRT dojo:#8074 and dojo:#8075
    if (r && r.nozip) {
      return r;
    }
    return _zip(r);
  }
function ( query , root ) { // NOTE: elementsById is not currently supported // NOTE: ignores xpath-ish queries for now //Set list constructor to desired value. This can change //between calls, so always re-assign here. if ( ! query ) { return [ ] ; } if ( query . constructor == Array ) { return /** @type {!Array} */ ( query ) ; } if ( ! goog . isString ( query ) ) { return [ query ] ; } if ( goog . isString ( root ) ) { root = goog . dom . getElement ( root ) ; if ( ! root ) { return [ ] ; } } root = root || goog . dom . getDocument ( ) ; var od = root . ownerDocument || root . documentElement ; // throw the big case sensitivity switch // NOTE: //    Opera in XHTML mode doesn't detect case-sensitivity correctly //    and it's not clear that there's any way to test for it caseSensitive = root . contentType && root . contentType == 'application/xml' || goog . userAgent . OPERA && ( root . doctype || od . toString ( ) == '[object XMLDocument]' ) || ! ! od && ( goog . userAgent . IE ? od . xml : ( root . xmlVersion || od . xmlVersion ) ) ; // NOTE: //    adding 'true' as the 2nd argument to getQueryFunc is useful for //    testing the DOM branch without worrying about the //    behavior/performance of the QSA branch. var r = getQueryFunc ( query ) ( root ) ; // FIXME(slightlyoff): //    need to investigate this branch WRT dojo:#8074 and dojo:#8075 if ( r && r . nozip ) { return r ; } return _zip ( r ) ; }
The main executor. Type specification from above.
@param {string|Array} query The query.
@param {(string|Node)=} root The root.
@return {!Array} The elements that matched the query.
The main executor . Type specification from above .