background-size.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
  3. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
  4. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  5. var Declaration = require('../declaration');
  6. var BackgroundSize = /*#__PURE__*/function (_Declaration) {
  7. _inheritsLoose(BackgroundSize, _Declaration);
  8. function BackgroundSize() {
  9. return _Declaration.apply(this, arguments) || this;
  10. }
  11. var _proto = BackgroundSize.prototype;
  12. /**
  13. * Duplication parameter for -webkit- browsers
  14. */
  15. _proto.set = function set(decl, prefix) {
  16. var value = decl.value.toLowerCase();
  17. if (prefix === '-webkit-' && !value.includes(' ') && value !== 'contain' && value !== 'cover') {
  18. decl.value = decl.value + ' ' + decl.value;
  19. }
  20. return _Declaration.prototype.set.call(this, decl, prefix);
  21. };
  22. return BackgroundSize;
  23. }(Declaration);
  24. _defineProperty(BackgroundSize, "names", ['background-size']);
  25. module.exports = BackgroundSize;