flex-basis.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. (function() {
  2. var Declaration, FlexBasis, 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. FlexBasis = (function(superClass) {
  8. extend(FlexBasis, superClass);
  9. function FlexBasis() {
  10. return FlexBasis.__super__.constructor.apply(this, arguments);
  11. }
  12. FlexBasis.names = ['flex-basis', 'flex-preferred-size'];
  13. FlexBasis.prototype.normalize = function() {
  14. return 'flex-basis';
  15. };
  16. FlexBasis.prototype.prefixed = function(prop, prefix) {
  17. var ref, spec;
  18. ref = flexSpec(prefix), spec = ref[0], prefix = ref[1];
  19. if (spec === 2012) {
  20. return prefix + 'flex-preferred-size';
  21. } else {
  22. return FlexBasis.__super__.prefixed.apply(this, arguments);
  23. }
  24. };
  25. FlexBasis.prototype.set = function(decl, prefix) {
  26. var ref, spec;
  27. ref = flexSpec(prefix), spec = ref[0], prefix = ref[1];
  28. if (spec === 2012 || spec === 'final') {
  29. return FlexBasis.__super__.set.apply(this, arguments);
  30. }
  31. };
  32. return FlexBasis;
  33. })(Declaration);
  34. module.exports = FlexBasis;
  35. }).call(this);