function getInitialGridElements(gridElement, elements) {
    // If we have a wildcard selector let's return all the children.
    if (elements === '*') {
      return gridElement.children;
    }

    // If we have some more specific selector, let's filter the elements.
    if (typeof elements === STRING_TYPE) {
      var result = [];
      var children = gridElement.children;
      for (var i = 0; i < children.length; i++) {
        if (elementMatches(children[i], elements)) {
          result.push(children[i]);
        }
      }
      return result;
    }

    // If we have an array of elements or a node list.
    if (Array.isArray(elements) || isNodeList(elements)) {
      return elements;
    }

    // Otherwise just return an empty array.
    return [];
  }
Collect and return initial items for grid.

@param {HTMLElement} gridElement
@param {?(HTMLElement[]|NodeList|HtmlCollection|String)} elements
@returns {(HTMLElement[]|NodeList|HtmlCollection)}