border-radius.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. (function() {
  2. var BorderRadius, Declaration,
  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. BorderRadius = (function(superClass) {
  7. var hor, i, j, len, len1, mozilla, normal, ref, ref1, ver;
  8. extend(BorderRadius, superClass);
  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);