break-inside.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. (function() {
  2. var BreakInside, 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. BreakInside = (function(_super) {
  7. __extends(BreakInside, _super);
  8. function BreakInside() {
  9. return BreakInside.__super__.constructor.apply(this, arguments);
  10. }
  11. BreakInside.names = ['break-inside', 'page-break-inside', 'column-break-inside'];
  12. BreakInside.prototype.prefixed = function(prop, prefix) {
  13. if (prefix === '-webkit-') {
  14. return prefix + 'column-break-inside';
  15. } else if (prefix === '-moz-') {
  16. return 'page-break-inside';
  17. } else {
  18. return BreakInside.__super__.prefixed.apply(this, arguments);
  19. }
  20. };
  21. BreakInside.prototype.normalize = function() {
  22. return 'break-inside';
  23. };
  24. BreakInside.prototype.set = function(decl, prefix) {
  25. if (decl.value === 'avoid-column' || decl.value === 'avoid-page') {
  26. decl.value = 'avoid';
  27. }
  28. return BreakInside.__super__.set.apply(this, arguments);
  29. };
  30. BreakInside.prototype.insert = function(decl, prefix, prefixes) {
  31. if (decl.value === 'avoid-region') {
  32. } else if (decl.value === 'avoid-page' && prefix === '-webkit-') {
  33. } else {
  34. return BreakInside.__super__.insert.apply(this, arguments);
  35. }
  36. };
  37. return BreakInside;
  38. })(Declaration);
  39. module.exports = BreakInside;
  40. }).call(this);