(props, value)
| 12 | // Accepts a list of property names and a single value |
| 13 | // Returns `undefined` if native detection not available |
| 14 | function nativeTestProps(props, value) { |
| 15 | var i = props.length; |
| 16 | // Start with the JS API: https://www.w3.org/TR/css3-conditional/#the-css-interface |
| 17 | if ('CSS' in window && 'supports' in window.CSS) { |
| 18 | // Try every prefixed variant of the property |
| 19 | while (i--) { |
| 20 | if (window.CSS.supports(domToCSS(props[i]), value)) { |
| 21 | return true; |
| 22 | } |
| 23 | } |
| 24 | return false; |
| 25 | } |
| 26 | // Otherwise fall back to at-rule (for Opera 12.x) |
| 27 | else if ('CSSSupportsRule' in window) { |
| 28 | // Build a condition string for every prefixed variant |
| 29 | var conditionText = []; |
| 30 | while (i--) { |
| 31 | conditionText.push('(' + domToCSS(props[i]) + ':' + value + ')'); |
| 32 | } |
| 33 | conditionText = conditionText.join(' or '); |
| 34 | return injectElementWithStyles('@supports (' + conditionText + ') { #modernizr { position: absolute; } }', function(node) { |
| 35 | return computedStyle(node, null, 'position') === 'absolute'; |
| 36 | }); |
| 37 | } |
| 38 | return undefined; |
| 39 | } |
| 40 | return nativeTestProps; |
| 41 | }); |
no test coverage detected
searching dependent graphs…