inline-logical.js 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. (function() {
  2. var Declaration, InlineLogical,
  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. Declaration = require('../declaration');
  6. InlineLogical = (function(superClass) {
  7. extend(InlineLogical, superClass);
  8. function InlineLogical() {
  9. return InlineLogical.__super__.constructor.apply(this, arguments);
  10. }
  11. InlineLogical.names = ['border-inline-start', 'border-inline-end', 'margin-inline-start', 'margin-inline-end', 'padding-inline-start', 'padding-inline-end', 'border-start', 'border-end', 'margin-start', 'margin-end', 'padding-start', 'padding-end'];
  12. InlineLogical.prototype.prefixed = function(prop, prefix) {
  13. return prefix + prop.replace('-inline', '');
  14. };
  15. InlineLogical.prototype.normalize = function(prop) {
  16. return prop.replace(/(margin|padding|border)-(start|end)/, '$1-inline-$2');
  17. };
  18. return InlineLogical;
  19. })(Declaration);
  20. module.exports = InlineLogical;
  21. }).call(this);