You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
830 B

3 months ago
  1. let Declaration = require('../declaration')
  2. let utils = require('./grid-utils')
  3. class PlaceSelf extends Declaration {
  4. /**
  5. * Translate place-self to separate -ms- prefixed properties
  6. */
  7. insert(decl, prefix, prefixes) {
  8. if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
  9. // prevent doubling of prefixes
  10. if (decl.parent.some(i => i.prop === '-ms-grid-row-align')) {
  11. return undefined
  12. }
  13. let [[first, second]] = utils.parse(decl)
  14. if (second) {
  15. utils.insertDecl(decl, 'grid-row-align', first)
  16. utils.insertDecl(decl, 'grid-column-align', second)
  17. } else {
  18. utils.insertDecl(decl, 'grid-row-align', first)
  19. utils.insertDecl(decl, 'grid-column-align', first)
  20. }
  21. return undefined
  22. }
  23. }
  24. PlaceSelf.names = ['place-self']
  25. module.exports = PlaceSelf