Requires

Provides

Proxies.js

Dont adopt children, pass them to some other widget

License:
Public domain (http://unlicense.org).
Authors:
Yaroslaff Fedin
  1. 23
  2. 24
  3. 25
  4. 26
  5. 27
  6. 28
  7. 29
  8. 30
  9. 31
  10. 32
  11. 33
  12. 34
  13. 35
  14. 36
  15. 37
  16. 38
  17. 39
  18. 40
  19. 41
  20. 42
  21. 43
  22. 44
  23. 45
  24. 46
  25. 47
  26. 48
  27. 49
  28. 50
  29. 51
  30. 52
  31. 53
  32. 54
  33. 55
  34. 56
  35. 57
  36. 58
  37. 59
  38. 60
  39. 61
  40. 62
  41. 63
  42. 64
  43. 65
  44. 66
LSD.Trait.Proxies = new Class({ options: { proxies: {} }, getProxies: Macro.getter('proxies', function() { var options = this.options.proxies; var proxies = []; for (var name in options) proxies.push(options[name]); return proxies.sort(function(a, b) { return (b.priority || 0) - (a.priority || 0) }) }), proxyChild: function(child) { for (var i = 0, proxies = this.getProxies(), proxy; proxy = proxies[i++];) { if (typeof proxy == 'string') proxy = this.options.proxies[proxy]; if (!proxy.condition.call(this, child)) continue; var self = this; var reinject = function(target) { if (proxy.rewrite === false) { self.appendChild(child, function() { target.adopt(child); }); } else { child.inject(target); } }; var container = proxy.container; if (container.call) { if ((container = container.call(this, reinject))) reinject(container); } else { this.use(container, reinject) } return true; } }, canAppendChild: function(child) { return !this.proxyChild(child); } });