image-set.js 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. (function() {
  2. var ImageSet, Value, list,
  3. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  4. hasProp = {}.hasOwnProperty;
  5. list = require('postcss/lib/list');
  6. Value = require('../value');
  7. ImageSet = (function(superClass) {
  8. extend(ImageSet, superClass);
  9. function ImageSet() {
  10. return ImageSet.__super__.constructor.apply(this, arguments);
  11. }
  12. ImageSet.names = ['image-set'];
  13. ImageSet.prototype.replace = function(string, prefix) {
  14. if (prefix === '-webkit-') {
  15. return ImageSet.__super__.replace.apply(this, arguments).replace(/("[^"]+"|'[^']+')(\s+\d+\w)/gi, 'url($1)$2');
  16. } else {
  17. return ImageSet.__super__.replace.apply(this, arguments);
  18. }
  19. };
  20. return ImageSet;
  21. })(Value);
  22. module.exports = ImageSet;
  23. }).call(this);