UNPKG

@oddbird/css-anchor-positioning

Version:

Polyfill for the proposed CSS anchor positioning spec

2 lines (1 loc) 590 B
import{p as o}from"./polyfill-SWhtadZ6.js";const t="anchorName"in document.documentElement.style,e=document.getElementById("apply-polyfill");t?(e.innerText="No Polyfill Needed",e.setAttribute("disabled",""),console.log("anchor-positioning is supported in this browser; polyfill skipped.")):e.addEventListener("click",()=>{document.querySelector("anchor-web-component").applyPolyfill().then(()=>{e.innerText="Polyfill Applied",e.setAttribute("disabled","")})});class l extends HTMLElement{applyPolyfill(){return o({roots:[this.shadowRoot]})}}customElements.define("anchor-web-component",l);