If the Element doesn't have a parent node, then it's not in a context
that it can be "removed" from.
So, either leave it for garbage collection...or, just delete it...

  var div = new Element();
  delete div;

If needed, surround it in a simple test to make sure:

  var div = new Element();
  [...] // may/may not be inserted into DOM
  if (!!div.parentNode)
    delete div;

- Jon L.

On Jan 25, 9:38 am, Zmitro Lapcjonak <[EMAIL PROTECTED]> wrote:
> Hi.
> The remove function texts:
> Element.Methods = {
> ...
>  remove: function(element) {
>    element = $(element);
>    element.parentNode.removeChild(element);
>    return element;},
> ...
> This code fails when element.parentNode == null
> I use prototype v 1.6
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 

Reply via email to