image-set.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5. var Value = require('../value');
  6. var ImageSet = function (_Value) {
  7. _inherits(ImageSet, _Value);
  8. function ImageSet() {
  9. _classCallCheck(this, ImageSet);
  10. return _possibleConstructorReturn(this, _Value.apply(this, arguments));
  11. }
  12. /**
  13. * Use non-standard name for WebKit and Firefox
  14. */
  15. ImageSet.prototype.replace = function replace(string, prefix) {
  16. var fixed = _Value.prototype.replace.call(this, string, prefix);
  17. if (prefix === '-webkit-') {
  18. fixed = fixed.replace(/("[^"]+"|'[^']+')(\s+\d+\w)/gi, 'url($1)$2');
  19. }
  20. return fixed;
  21. };
  22. return ImageSet;
  23. }(Value);
  24. Object.defineProperty(ImageSet, 'names', {
  25. enumerable: true,
  26. writable: true,
  27. value: ['image-set']
  28. });
  29. module.exports = ImageSet;