code: function applyTemplate(el, options) {
    // Array.from() is required to break the reference to the original parent.
    const children = Array.from(el.childNodes);
  
    if (options.template) {
      el.innerHTML = options.template;
    } else if (options.templateId) {
      let template = document.querySelector(options.templateId);
      if (!template) throw new Error('Template not found:', options.templateId);
      while(el.firstChild) el.removeChild(el.firstChild);
      let clone = document.importNode(template.content, true);
      el.appendChild(clone);
    }
  
    if (!children.length) return;
    const defaultSlot = el.querySelector('slot:not([name])');
  
    for (let child of children) {
      let name = child.getAttribute ? child.getAttribute('slot') : null;
      let slot = name ? el.querySelector(`slot[name="${name}"]`) : defaultSlot;
      if (slot) slot.parentNode.insertBefore(child, slot);
    }
  
    for (let slot of el.querySelectorAll('slot')) {
      slot.parentNode.removeChild(slot);
    }
  }
docs: ----------------------------------------------------------------------------- Utility Functions