grid-start.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5. var Declaration = require('../declaration');
  6. var GridStart = function (_Declaration) {
  7. _inherits(GridStart, _Declaration);
  8. function GridStart() {
  9. _classCallCheck(this, GridStart);
  10. return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
  11. }
  12. /**
  13. * Do not add prefix for unsupported value in IE
  14. */
  15. GridStart.prototype.check = function check(decl) {
  16. var value = decl.value;
  17. return value.indexOf('/') === -1 || value.indexOf('span') !== -1;
  18. };
  19. /**
  20. * Return a final spec property
  21. */
  22. GridStart.prototype.normalize = function normalize(prop) {
  23. return prop.replace('-start', '');
  24. };
  25. /**
  26. * Change property name for IE
  27. */
  28. GridStart.prototype.prefixed = function prefixed(prop, prefix) {
  29. var result = _Declaration.prototype.prefixed.call(this, prop, prefix);
  30. if (prefix === '-ms-') {
  31. result = result.replace('-start', '');
  32. }
  33. return result;
  34. };
  35. return GridStart;
  36. }(Declaration);
  37. Object.defineProperty(GridStart, 'names', {
  38. enumerable: true,
  39. writable: true,
  40. value: ['grid-row-start', 'grid-column-start']
  41. });
  42. module.exports = GridStart;