This is a custom element / web component built using vanilla JavaScript to embed GistHub Gists into a webpage
without having to worry about the inline scripts which call document.write()
. It can be configured to lazy-load
using loading="lazy"
and styled with CSS through the github-gist
& github-gist::part(embed)
selectors.
Under-the-hood it creates an <iframe>
using:
<iframe srcdoc="..." sandbox="allow-scripts allow-popups" width="..." height="..." referrerpolicy="no-referrer"></iframe>