flex-grow.js 595 B

123456789101112131415161718192021222324252627282930
  1. let flexSpec = require('./flex-spec')
  2. let Declaration = require('../declaration')
  3. class Flex extends Declaration {
  4. /**
  5. * Return property name by final spec
  6. */
  7. normalize() {
  8. return 'flex'
  9. }
  10. /**
  11. * Return flex property for 2009 and 2012 specs
  12. */
  13. prefixed(prop, prefix) {
  14. let spec
  15. ;[spec, prefix] = flexSpec(prefix)
  16. if (spec === 2009) {
  17. return prefix + 'box-flex'
  18. }
  19. if (spec === 2012) {
  20. return prefix + 'flex-positive'
  21. }
  22. return super.prefixed(prop, prefix)
  23. }
  24. }
  25. Flex.names = ['flex-grow', 'flex-positive']
  26. module.exports = Flex