No Description

display-flex.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. (function() {
  2. var DisplayFlex, OldDisplayFlex, OldValue, Value, 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. OldValue = require('../old-value');
  7. Value = require('../value');
  8. OldDisplayFlex = (function(superClass) {
  9. extend(OldDisplayFlex, superClass);
  10. function OldDisplayFlex(unprefixed, prefixed1) {
  11. this.unprefixed = unprefixed;
  12. this.prefixed = prefixed1;
  13. }
  14. OldDisplayFlex.prototype.check = function(value) {
  15. return value === this.name;
  16. };
  17. return OldDisplayFlex;
  18. })(OldValue);
  19. DisplayFlex = (function(superClass) {
  20. extend(DisplayFlex, superClass);
  21. DisplayFlex.names = ['display-flex', 'inline-flex'];
  22. function DisplayFlex(name, prefixes) {
  23. DisplayFlex.__super__.constructor.apply(this, arguments);
  24. if (name === 'display-flex') {
  25. this.name = 'flex';
  26. }
  27. }
  28. DisplayFlex.prototype.check = function(decl) {
  29. return decl.value === this.name;
  30. };
  31. DisplayFlex.prototype.prefixed = function(prefix) {
  32. var ref, spec;
  33. ref = flexSpec(prefix), spec = ref[0], prefix = ref[1];
  34. return prefix + (spec === 2009 ? this.name === 'flex' ? 'box' : 'inline-box' : spec === 2012 ? this.name === 'flex' ? 'flexbox' : 'inline-flexbox' : spec === 'final' ? this.name : void 0);
  35. };
  36. DisplayFlex.prototype.replace = function(string, prefix) {
  37. return this.prefixed(prefix);
  38. };
  39. DisplayFlex.prototype.old = function(prefix) {
  40. var prefixed;
  41. prefixed = this.prefixed(prefix);
  42. if (prefixed) {
  43. return new OldValue(this.name, prefixed);
  44. }
  45. };
  46. return DisplayFlex;
  47. })(Value);
  48. module.exports = DisplayFlex;
  49. }).call(this);