background-size.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. (function() {
  2. var BackgroundSize, Declaration,
  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. Declaration = require('../declaration');
  6. BackgroundSize = (function(superClass) {
  7. extend(BackgroundSize, superClass);
  8. function BackgroundSize() {
  9. return BackgroundSize.__super__.constructor.apply(this, arguments);
  10. }
  11. BackgroundSize.names = ['background-size'];
  12. BackgroundSize.prototype.set = function(decl, prefix) {
  13. var value;
  14. value = decl.value.toLowerCase();
  15. if (prefix === '-webkit-' && value.indexOf(' ') === -1 && value !== 'contain' && value !== 'cover') {
  16. decl.value = decl.value + ' ' + decl.value;
  17. }
  18. return BackgroundSize.__super__.set.call(this, decl, prefix);
  19. };
  20. return BackgroundSize;
  21. })(Declaration);
  22. module.exports = BackgroundSize;
  23. }).call(this);