opacity.js 766 B

1234567891011121314151617181920212223
  1. /*!
  2. {
  3. "name": "CSS Opacity",
  4. "caniuse": "css-opacity",
  5. "property": "opacity",
  6. "tags": ["css"]
  7. }
  8. !*/
  9. define(['Modernizr', 'createElement', 'prefixes'], function(Modernizr, createElement, prefixes) {
  10. // Browsers that actually have CSS Opacity implemented have done so
  11. // according to spec, which means their return values are within the
  12. // range of [0.0,1.0] - including the leading zero.
  13. Modernizr.addTest('opacity', function() {
  14. var style = createElement('a').style;
  15. style.cssText = prefixes.join('opacity:.55;');
  16. // The non-literal . in this regex is intentional:
  17. // German Chrome returns this value as 0,55
  18. // github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632
  19. return (/^0.55$/).test(style.opacity);
  20. });
  21. });