 wrapper.setHTMLUnsafe(html);
      // Get hold of the declarative shadow root in a way that works when its mode is "closed"
      shadowRoot = wrapper.firstElementChild.attachShadow(initDict);
    } else {
      // Imperative shadow dom
      const element = document.createElement(elementType);
      wrapper.appendChild(element);
      const temp = document.createElement('div');
      temp.innerHTML = lightDOMContent;
      element.append(...temp.childNodes);
      if (allowsShadowDom) {
        shadowRoot