Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/termi/CSS.supports
CSS.supports polyfill
https://github.com/termi/CSS.supports
Last synced: 14 days ago
JSON representation
CSS.supports polyfill
- Host: GitHub
- URL: https://github.com/termi/CSS.supports
- Owner: termi
- Created: 2012-12-10T09:09:34.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-03-13T14:32:30.000Z (over 10 years ago)
- Last Synced: 2024-10-28T11:45:03.877Z (16 days ago)
- Language: JavaScript
- Size: 144 KB
- Stars: 50
- Watchers: 7
- Forks: 12
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
CSS.supports
A polyfill to add window.CSS.supports JavaScript API support to browsers without support @supports. It uses window.supportsCSS if available.
window.CSS.supports is the proposed object defined in the [CSS Conditional Rules Module Level 3](http://www.w3.org/TR/css3-conditional/) specification. Opera added support for window.supportsCSS() in version 12.10 of the browser. Though @support is enabled in Firefox 17.0 behind a flag, the JavaScript API is not yet available.
Other browsers have not yet added support ([check current support tables](http://caniuse.com/#feat=css-featurequeries)).
This polyfill bring both syntax of CSS.supports:
```
interface CSS {
boolean supports(DOMString property, DOMString value);
boolean supports(DOMString declaration);
}
```
so you can write:
```javascript
CSS.supports("(display: none) and(display:flex)") == (CSS.supports("display", "none") && CSS.supports("display", "flex"))
```