code: function expandContentElements(nodes, includeTextNodes) {
    const expanded = Array.prototype.map.call(nodes, node => {
      // We want to see if the node is an instanceof HTMLSlotELement, but
      // that class won't exist if the browser that doesn't support native
      // Shadow DOM and if the Shadow DOM polyfill hasn't been loaded. Instead,
      // we do a simplistic check to see if the tag name is "slot".
      const isSlot = typeof HTMLSlotElement !== 'undefined' ?
        node instanceof HTMLSlotElement :
        node.localName === 'slot';
      if (isSlot) {
        // Use the nodes assigned to this node instead.
        const assignedNodes = node.assignedNodes({ flatten: true });
        return assignedNodes ?
          expandContentElements(assignedNodes, includeTextNodes) :
          [];
      } else if (node instanceof HTMLElement) {
        // Plain element; use as is.
        return [node];
      } else if (node instanceof Text && includeTextNodes) {
        // Text node.
        return [node];
      } else {
        // Comment, processing instruction, etc.; skip.
        return [];
      }
    });
    const flattened = [].concat(...expanded);
    return flattened;
  }
docs: /*
  Given a array of nodes, return a new array with any content elements expanded
  to the nodes distributed to that content element. This rule is applied
  recursively.
  
  If includeTextNodes is true, text nodes will be included, as in the
  standard childNodes property; by default, this skips text nodes, like the
  standard children property.