export function injectSelf() { // If a current provider exists, exit injectIntoDocument(document); } export function injectIntoDocument(doc: Document) { // If a current provider exists or no mounting location is provided, exit const providerLocation = doc.querySelector("#ol-provider"); if (!providerLocation || doc.querySelector("ol-provider")) return; // Create the container for the provider element const providerContainer = doc.createElement('ol-provider'); // Set the tags from the class name if (providerLocation.className) providerContainer.setAttribute("tags", providerLocation.className); // Get the children to the document body const children = providerLocation.children; if (!children) return; // Append the children to the provider providerContainer.append(...children); providerLocation.appendChild(providerContainer); }