Hi there!

  I need to remove an arbitray element from the DOM and add it later
exactly to the same point in the DOM.  I wonder is there is a direct
way to achieve this.  Right now i have to check wether the element has
a previous sibling or directly a parent and remember this information
to add it back.

  When i remove i do something like:

  var e = $( ...),
      previousSiblings = e.previousSiblings();

  if( previousSiblings.size() > 0) {
    this._insertPoint = previousSiblings.first();       // it has a sibling
  } else {
    this._insertPoint = e.parentNode;           // no sibling, use parent as
reference
    this._insertPointIsParent = true;
  }

  And to add it back:

  var e = $( ...);

  if( this._insertPointIsParent) {
    this._insertPoint.insert( { top: e});
  } else {
    this._insertPoint.insert( { after: e});
  }

  So, there is any direct way to do this or i have to use this
algorithm?

  Thanks!

  /AITOR

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to