user-select.js 711 B

123456789101112131415161718192021222324252627282930313233
  1. let Declaration = require('../declaration')
  2. class UserSelect extends Declaration {
  3. /**
  4. * Avoid prefixing all in IE
  5. */
  6. insert(decl, prefix, prefixes) {
  7. if (decl.value === 'all' && prefix === '-ms-') {
  8. return undefined
  9. } else if (
  10. decl.value === 'contain' &&
  11. (prefix === '-moz-' || prefix === '-webkit-')
  12. ) {
  13. return undefined
  14. } else {
  15. return super.insert(decl, prefix, prefixes)
  16. }
  17. }
  18. /**
  19. * Change prefixed value for IE
  20. */
  21. set(decl, prefix) {
  22. if (prefix === '-ms-' && decl.value === 'contain') {
  23. decl.value = 'element'
  24. }
  25. return super.set(decl, prefix)
  26. }
  27. }
  28. UserSelect.names = ['user-select']
  29. module.exports = UserSelect