Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

Commit

Permalink
fix and simplify the logic of details-polyfill-detect
Browse files Browse the repository at this point in the history
  • Loading branch information
http://jneen.net/ committed Dec 9, 2019
1 parent 62b898a commit ef0f025
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions assets/js/details-polyfill-detect.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
const needsPolyfill = () => {
if (typeof Promise === 'function') return false
if (document.querySelector('details') !== null) return false
return true
}

if (needsPolyfill()) {
if (typeof Promise !== "function" &&
document.querySelector('details') !== null) {
const script = '<script src="/js/details-element-polyfill.js"><\/script>'
document.write(script) // lgtm[js/eval-like-call]
}

0 comments on commit ef0f025

Please sign in to comment.