├── .gitignore ├── README.md ├── __COMPILED └── CSS.supports.js └── __SRC └── CSS.supports.js /.gitignore: -------------------------------------------------------------------------------- 1 | .sass-cache 2 | .idea 3 | *.DS_Store 4 | *.swp 5 | .project 6 | .settings 7 | *.iml 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CSS.supports 2 | 3 | A polyfill to add window.CSS.supports JavaScript API support to browsers without support @supports. It uses window.supportsCSS if available. 4 | 5 | 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. 6 | 7 | Other browsers have not yet added support ([check current support tables](http://caniuse.com/#feat=css-featurequeries)). 8 | 9 | This polyfill bring both syntax of CSS.supports: 10 | ``` 11 | interface CSS { 12 | boolean supports(DOMString property, DOMString value); 13 | boolean supports(DOMString declaration); 14 | } 15 | ``` 16 | so you can write: 17 | ```javascript 18 | CSS.supports("(display: none) and(display:flex)") == (CSS.supports("display", "none") && CSS.supports("display", "flex")) 19 | ``` 20 | -------------------------------------------------------------------------------- /__COMPILED/CSS.supports.js: -------------------------------------------------------------------------------- 1 | /* CSS.supports polyfill | @version 0.4 | MIT License | github.com/termi/CSS.supports */ 2 | ;(function(){"use strict";function s(l){function e(){var b=d.length-1;0>b&&(t=!1);return d[b]}function a(c){var l=d.length-1;0>l&&(t=!1);b=d[l]=c}function m(b,c,a,d){r=a||h;var e,f,g;d&&r--;do if(a=l.charAt(++r),d)(g=a&&(e||f),"'"==a||'"'==a)?g=e=!e:e||(f||"("!=a?f&&")"==a&&(f=!1,g=!0):g=f=!0);while(g||a&&!(b&&a==b||c&&a!=c));if(null==b||a==b)return r}l||s.a();var d=[],f,b,t=!0,k,n,q,w,u,g=41,c,h=-1,r,v=l.length;for(d.push(void 0);++h