border-radius.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. (function() {
  2. var BorderRadius, 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. BorderRadius = (function(_super) {
  7. var hor, mozilla, normal, ver, _i, _j, _len, _len1, _ref, _ref1;
  8. __extends(BorderRadius, _super);
  9. function BorderRadius() {
  10. return BorderRadius.__super__.constructor.apply(this, arguments);
  11. }
  12. BorderRadius.names = ['border-radius'];
  13. BorderRadius.toMozilla = {};
  14. BorderRadius.toNormal = {};
  15. _ref = ['top', 'bottom'];
  16. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  17. ver = _ref[_i];
  18. _ref1 = ['left', 'right'];
  19. for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
  20. hor = _ref1[_j];
  21. normal = "border-" + ver + "-" + hor + "-radius";
  22. mozilla = "border-radius-" + ver + hor;
  23. BorderRadius.names.push(normal);
  24. BorderRadius.names.push(mozilla);
  25. BorderRadius.toMozilla[normal] = mozilla;
  26. BorderRadius.toNormal[mozilla] = normal;
  27. }
  28. }
  29. BorderRadius.prototype.prefixed = function(prop, prefix) {
  30. if (prefix === '-moz-') {
  31. return prefix + (BorderRadius.toMozilla[prop] || prop);
  32. } else {
  33. return BorderRadius.__super__.prefixed.apply(this, arguments);
  34. }
  35. };
  36. BorderRadius.prototype.normalize = function(prop) {
  37. return BorderRadius.toNormal[prop] || prop;
  38. };
  39. return BorderRadius;
  40. })(Declaration);
  41. module.exports = BorderRadius;
  42. }).call(this);