overscroll-behavior.js 677 B

123456789101112131415161718192021222324252627282930313233
  1. let Declaration = require('../declaration')
  2. class OverscrollBehavior extends Declaration {
  3. /**
  4. * Change property name for IE
  5. */
  6. prefixed(prop, prefix) {
  7. return prefix + 'scroll-chaining'
  8. }
  9. /**
  10. * Return property name by spec
  11. */
  12. normalize() {
  13. return 'overscroll-behavior'
  14. }
  15. /**
  16. * Change value for IE
  17. */
  18. set(decl, prefix) {
  19. if (decl.value === 'auto') {
  20. decl.value = 'chained'
  21. } else if (decl.value === 'none' || decl.value === 'contain') {
  22. decl.value = 'none'
  23. }
  24. return super.set(decl, prefix)
  25. }
  26. }
  27. OverscrollBehavior.names = ['overscroll-behavior', 'scroll-chaining']
  28. module.exports = OverscrollBehavior