Skip to content

Instantly share code, notes, and snippets.

@adamduncan
Last active March 22, 2020 12:54
Show Gist options
  • Save adamduncan/811dd14e253138ba057e3c26921eba46 to your computer and use it in GitHub Desktop.
Save adamduncan/811dd14e253138ba057e3c26921eba46 to your computer and use it in GitHub Desktop.
<script>
/*! loadJS: load a JS file asynchronously. [c]2014 @scottjehl, Filament Group, Inc. (Based on http://goo.gl/REQGQ by Paul Irish). Licensed MIT */
!function(e){var t=function(t,o,n){"use strict";var r,a=e.document.getElementsByTagName("script")[0],c=e.document.createElement("script");return"boolean"==typeof o&&(r=n,n=o,o=r),c.src=t,c.async=!n,a.parentNode.insertBefore(c,a),o&&"function"==typeof o&&(c.onload=o),c};"undefined"!=typeof module?module.exports=t:e.loadJS=t}("undefined"!=typeof global?global:this);
// Polyfill custom properties for <= IE11
if (!window.CSS || !window.CSS.supports || !window.CSS.supports('--a', 0)) {
loadJS('https://unpkg.com/css-vars-ponyfill@2/dist/css-vars-ponyfill.min.js', function() {
cssVars();
})
}
</script>
@adamduncan
Copy link
Author

Safari gives false positives here, so if you're just looking to polyfill IE, add documentMode:

(!window.CSS || !window.CSS.supports || !window.CSS.supports('--a', 0)) && document.documentMode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment