Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

productboard/css-supports

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

CSS.supports shim

Installation

npm install css-supports --save

Usage

Without shimming (recommended)

import supports from 'css-supports';

supports('backdrop-filter', 'blur(20px)');
supports('(backdrop-filter: blur(20px)) or (-webkit-backdrop-filter: blur(20px))');

With shimming

import supports from 'css-supports';
supports.shim();

CSS.supports('backdrop-filter', 'blur(20px)');
CSS.supports('(backdrop-filter: blur(20px)) or (-webkit-backdrop-filter: blur(20px))');

Spec & more

https://developer.mozilla.org/en-US/docs/Web/API/CSS/supports http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/css/DOMWindowCSS.cpp https://chromium.googlesource.com/chromium/blink/+/master/Source/core/css/DOMWindowCSS.cpp https://hg.mozilla.org/mozilla-central/file/b23b2fa33a9d/layout/style/CSS.cpp

TODO

  • Add tests

License

Inspired by https://gist.github.com/codler/03a0995195aa2859465f
MIT