overscroll-behavior.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. "use strict";
  2. function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
  3. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
  4. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  5. var Declaration = require('../declaration');
  6. var OverscrollBehavior = /*#__PURE__*/function (_Declaration) {
  7. _inheritsLoose(OverscrollBehavior, _Declaration);
  8. function OverscrollBehavior() {
  9. return _Declaration.apply(this, arguments) || this;
  10. }
  11. var _proto = OverscrollBehavior.prototype;
  12. /**
  13. * Change property name for IE
  14. */
  15. _proto.prefixed = function prefixed(prop, prefix) {
  16. return prefix + 'scroll-chaining';
  17. }
  18. /**
  19. * Return property name by spec
  20. */
  21. ;
  22. _proto.normalize = function normalize() {
  23. return 'overscroll-behavior';
  24. }
  25. /**
  26. * Change value for IE
  27. */
  28. ;
  29. _proto.set = function set(decl, prefix) {
  30. if (decl.value === 'auto') {
  31. decl.value = 'chained';
  32. } else if (decl.value === 'none' || decl.value === 'contain') {
  33. decl.value = 'none';
  34. }
  35. return _Declaration.prototype.set.call(this, decl, prefix);
  36. };
  37. return OverscrollBehavior;
  38. }(Declaration);
  39. _defineProperty(OverscrollBehavior, "names", ['overscroll-behavior', 'scroll-chaining']);
  40. module.exports = OverscrollBehavior;