OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Node.insertAfter in DOM

[ Lists Home | Date Index | Thread Index ]

Hi,
  I just noticed that there isn't an insertAfter( ) method in the Node
interface specified in DOM level 2. How come?

Anyway, in getting around this I had a question about getNextSibling( ), am I
correct in assuming that it gets the next node in document order that is a
child of the current node's parent?

Second question, if my assumption about getNextSibling( ) is correct is there
anything wrong with

    node parent     = target.getParentNode( );
    Node refChild = target.getNextSibling( );

   if(refChild != null)
    parent.insertBefore(newNode, refChild);
   else
    parent.appendChild(newNode);

as a way to simulate parent.insertAfter(newNode, target ) semantics?

PS: It is interesting that I've used the DOM a few times over the past few
years and never had need for any of the above methods. Weird.

--
THINGS TO DO IF I BECOME AN EVIL OVERLORD #49
If I learn the whereabouts of the one artifact which can destroy me, I
will not send all my troops out to seize it. Instead I will send them
out to seize something else and quietly put a Want-Ad in the local paper.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS