flex-grow.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. (function() {
  2. var Declaration, Flex, 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. Flex = (function(superClass) {
  8. extend(Flex, superClass);
  9. function Flex() {
  10. return Flex.__super__.constructor.apply(this, arguments);
  11. }
  12. Flex.names = ['flex-grow', 'flex-positive'];
  13. Flex.prototype.normalize = function() {
  14. return 'flex';
  15. };
  16. Flex.prototype.prefixed = function(prop, prefix) {
  17. var ref, spec;
  18. ref = flexSpec(prefix), spec = ref[0], prefix = ref[1];
  19. if (spec === 2009) {
  20. return prefix + 'box-flex';
  21. } else if (spec === 2012) {
  22. return prefix + 'flex-positive';
  23. } else {
  24. return Flex.__super__.prefixed.apply(this, arguments);
  25. }
  26. };
  27. return Flex;
  28. })(Declaration);
  29. module.exports = Flex;
  30. }).call(this);