writing-mode.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. (function() {
  2. var Declaration, WritingMode,
  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. WritingMode = (function(superClass) {
  7. extend(WritingMode, superClass);
  8. function WritingMode() {
  9. return WritingMode.__super__.constructor.apply(this, arguments);
  10. }
  11. WritingMode.names = ['writing-mode'];
  12. WritingMode.msValues = {
  13. 'horizontal-tb': 'lr-tb',
  14. 'vertical-rl': 'tb-rl',
  15. 'vertical-lr': 'tb-lr'
  16. };
  17. WritingMode.prototype.set = function(decl, prefix) {
  18. if (prefix === '-ms-') {
  19. decl.value = WritingMode.msValues[decl.value] || decl.value;
  20. return WritingMode.__super__.set.call(this, decl, prefix);
  21. } else {
  22. return WritingMode.__super__.set.apply(this, arguments);
  23. }
  24. };
  25. return WritingMode;
  26. })(Declaration);
  27. module.exports = WritingMode;
  28. }).call(this);