block-logical.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. (function() {
  2. var BlockLogical, Declaration,
  3. __extends = 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. Declaration = require('../declaration');
  6. BlockLogical = (function(_super) {
  7. __extends(BlockLogical, _super);
  8. function BlockLogical() {
  9. return BlockLogical.__super__.constructor.apply(this, arguments);
  10. }
  11. BlockLogical.names = ['border-block-start', 'border-block-end', 'margin-block-start', 'margin-block-end', 'padding-block-start', 'padding-block-end', 'border-before', 'border-after', 'margin-before', 'margin-after', 'padding-before', 'padding-after'];
  12. BlockLogical.prototype.prefixed = function(prop, prefix) {
  13. return prefix + (prop.indexOf('-start') !== -1 ? prop.replace('-block-start', '-before') : prop.replace('-block-end', '-after'));
  14. };
  15. BlockLogical.prototype.normalize = function(prop) {
  16. if (prop.indexOf('-before') !== -1) {
  17. return prop.replace('-before', '-block-start');
  18. } else {
  19. return prop.replace('-after', '-block-end');
  20. }
  21. };
  22. return BlockLogical;
  23. })(Declaration);
  24. module.exports = BlockLogical;
  25. }).call(this);