grid-start.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4. 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; }
  5. 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) : _defaults(subClass, superClass); }
  6. var Declaration = require('../declaration');
  7. var GridStart = function (_Declaration) {
  8. _inherits(GridStart, _Declaration);
  9. function GridStart() {
  10. _classCallCheck(this, GridStart);
  11. return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
  12. }
  13. /**
  14. * Do not add prefix for unsupported value in IE
  15. */
  16. GridStart.prototype.check = function check(decl) {
  17. var value = decl.value;
  18. return value.indexOf('/') === -1 || value.indexOf('span') !== -1;
  19. };
  20. /**
  21. * Return a final spec property
  22. */
  23. GridStart.prototype.normalize = function normalize(prop) {
  24. return prop.replace('-start', '');
  25. };
  26. /**
  27. * Change property name for IE
  28. */
  29. GridStart.prototype.prefixed = function prefixed(prop, prefix) {
  30. var result = _Declaration.prototype.prefixed.call(this, prop, prefix);
  31. if (prefix === '-ms-') {
  32. result = result.replace('-start', '');
  33. }
  34. return result;
  35. };
  36. return GridStart;
  37. }(Declaration);
  38. Object.defineProperty(GridStart, 'names', {
  39. enumerable: true,
  40. writable: true,
  41. value: ['grid-row-start', 'grid-column-start']
  42. });
  43. module.exports = GridStart;