flex-shrink.js 801 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. let flexSpec = require('./flex-spec')
  2. let Declaration = require('../declaration')
  3. class FlexShrink extends Declaration {
  4. /**
  5. * Return property name by final spec
  6. */
  7. normalize() {
  8. return 'flex-shrink'
  9. }
  10. /**
  11. * Return flex property for 2012 spec
  12. */
  13. prefixed(prop, prefix) {
  14. let spec
  15. ;[spec, prefix] = flexSpec(prefix)
  16. if (spec === 2012) {
  17. return prefix + 'flex-negative'
  18. }
  19. return super.prefixed(prop, prefix)
  20. }
  21. /**
  22. * Ignore 2009 spec and use flex property for 2012
  23. */
  24. set(decl, prefix) {
  25. let spec
  26. ;[spec, prefix] = flexSpec(prefix)
  27. if (spec === 2012 || spec === 'final') {
  28. return super.set(decl, prefix)
  29. }
  30. return undefined
  31. }
  32. }
  33. FlexShrink.names = ['flex-shrink', 'flex-negative']
  34. module.exports = FlexShrink