Advertisement
Guest User

Untitled

a guest
Jul 31st, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. function Drawing (id, element) {
  2. /*
  3. * Section A: value of 'this' object of type 'Drawing' (expected);
  4. * Variables I ought to have access to from any point in Drawing's invocation
  5. */
  6. { // Preconstruction
  7. var Drawing = this;
  8. var SVG = document.createElementNS('http://www.w3.org/2000/svg', "SVG");
  9. support.dom.Associative.call(Drawing, id, element);
  10. element = Drawing.$(); // In case element was null
  11. element.className = "Drawing";
  12. // Things in or about the drawing
  13. var shapes = [];
  14.  
  15. }
  16.  
  17.  
  18. function add (shape) {
  19. /*
  20. * Section B: value of 'this' Window object
  21. * What gives in this function?
  22. * Variables I have access to from section A:
  23. * element: yes, id: no, Drawing: no, SVG: yes
  24. * ?$@#$%^$#!!!!! Help me!
  25. */
  26. if (shape instanceof Shape) {
  27. shapes.push(shape);
  28. if(!this.render) SVG.appendChild(shape.toSVG());
  29. return shape;
  30. }
  31. }
  32.  
  33.  
  34. this.modify = function (options) {
  35. if (options.create) {
  36. return add(create[options.create](options));
  37. }
  38. };
  39. }
  40.  
  41. function Class () {
  42. // this: an object with a prototype of Class, if 'new'ed, window otherwise
  43. var that = this;
  44. function privateMethod () {
  45. // this: a reference to window. privateMethod still belongs to Class' closure
  46. var dat = this;
  47.  
  48. // that: an object with a prototype of Class, if 'new'ed, window otherwise
  49. var dis = that;
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement