GoogleChrome / dialog-polyfill

Polyfill for the HTML dialog element
BSD 3-Clause "New" or "Revised" License
2.45k stars 245 forks source link

how to detect if poly is needed? #185

Closed cekvenich closed 5 years ago

cekvenich commented 5 years ago

I want to only load poly if needed. Is this a good way?:

if ( !document.body.show ) { ... }

cekvenich commented 5 years ago

This works, but not sure if best:

var tstDia = <dialog id="d1001">
                <p>oh hi there</p>
          </dialog>
document.body.innerHTML +=tstDia

var tstAns = document.getElementById('d1001').show
ray007 commented 5 years ago

How about !!window.HTMLDialogElement?