Created
April 3, 2020 20:27
-
-
Save jcheng5/4d69fbcb9625c9b3897260f60a226dca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{js echo=FALSE} | |
function enshadowGtTable(tableEl) { | |
var containerEl = tableEl.parentElement; | |
var styleEl = containerEl.previousElementSibling; | |
if (containerEl.tagName !== "DIV" || styleEl.tagName !== "STYLE") { | |
throw new Error("Unexpected document structure"); | |
} | |
var shadowDiv = document.createElement("div"); | |
shadowDiv.classList.add("gt-shadow-container"); | |
containerEl.parentElement.insertBefore(shadowDiv, styleEl); | |
var shadowRoot = shadowDiv.attachShadow({mode: "open"}); | |
shadowRoot.appendChild(styleEl); | |
shadowRoot.appendChild(containerEl); | |
} | |
document.querySelectorAll(".gt_table").forEach(enshadowGtTable); | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment