Ingen beskrivning

align-content.js 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. (function() {
  2. var AlignContent, Declaration, flexSpec,
  3. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  4. hasProp = {}.hasOwnProperty;
  5. flexSpec = require('./flex-spec');
  6. Declaration = require('../declaration');
  7. AlignContent = (function(superClass) {
  8. extend(AlignContent, superClass);
  9. function AlignContent() {
  10. return AlignContent.__super__.constructor.apply(this, arguments);
  11. }
  12. AlignContent.names = ['align-content', 'flex-line-pack'];
  13. AlignContent.oldValues = {
  14. 'flex-end': 'end',
  15. 'flex-start': 'start',
  16. 'space-between': 'justify',
  17. 'space-around': 'distribute'
  18. };
  19. AlignContent.prototype.prefixed = function(prop, prefix) {
  20. var ref, spec;
  21. ref = flexSpec(prefix), spec = ref[0], prefix = ref[1];
  22. if (spec === 2012) {
  23. return prefix + 'flex-line-pack';
  24. } else {
  25. return AlignContent.__super__.prefixed.apply(this, arguments);
  26. }
  27. };
  28. AlignContent.prototype.normalize = function(prop) {
  29. return 'align-content';
  30. };
  31. AlignContent.prototype.set = function(decl, prefix) {
  32. var spec;
  33. spec = flexSpec(prefix)[0];
  34. if (spec === 2012) {
  35. decl.value = AlignContent.oldValues[decl.value] || decl.value;
  36. return AlignContent.__super__.set.call(this, decl, prefix);
  37. } else if (spec === 'final') {
  38. return AlignContent.__super__.set.apply(this, arguments);
  39. }
  40. };
  41. return AlignContent;
  42. })(Declaration);
  43. module.exports = AlignContent;
  44. }).call(this);