Guest User

Untitled

a guest
Jun 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. // FOO.Element
  2. //
  3. // I have added a check in Object.extends definition that checks if the passed in extending Object has a property called FOO_INIT.
  4. // So when I say: Object.extend(element,FOO.Element.Element, the FOO_INIT function inside of FOO.Element.Element runs.
  5. //
  6. // so I can say $FOO(element) and get an element extended with both $() and FOO.Element.Element.
  7. // Thats all fine a dandy.
  8. //
  9. //
  10. // This only works with existing DOM nodes.
  11. // So I created: FOO.A = function(){return $a({class:'FOO_GEN FOO_A'});}
  12. // That will enable me to say $FOO(FOO.A()); and get back a brand new FOO Element
  13. //
  14. // The problem that Im having is with FOO.Element.A
  15. //
  16. // What I really need is for the element return from $FOO() to be a class in its own right.
  17. // That I can either create new ones of or get existing DOM nodes to become them
  18.  
  19. // Enough explanation. I will just post this and answer questions if there are any
  20. if(!FOO) var FOO = {};
  21.  
  22. FOO.Element = {};
  23.  
  24. FOO.Element.Element = {
  25. FOO_INIT:function()
  26. {
  27. this.CommandStack = new JS.Command.Stack();
  28. }
  29. }
  30.  
  31. var $FOO = function(element)
  32. {
  33. element = $(element);
  34. if(!element._isFOOElement)
  35. {
  36. Object.extend(element,FOO.Element.Element);
  37. element._isFOOElement = true;
  38. }
  39. return element;
  40. }
  41.  
  42. FOO.Element.A = Class.create(FOO.Element.Element,{});
  43.  
  44. FOO.A = function(){return $a({class:'FOO_GEN FOO_A'});}
Add Comment
Please, Sign In to add comment