faqts : Computers : Programming : Languages : JavaScript : XML : E4X (ECMAScript for XML) : XMLList objects

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

How do I use the method copy?
How do I use the method copy?

Apr 15th, 2005 03:02
Martin Honnen,


The method copy takes no argument and returns a deep copy of the XMLList
it is called on. The result is a new XMLList containing deep copies of
all the objects in the original XMLList. 
Here are some examples:
  var xmlList = <>
    <god>Kibo</god>
    <god>Xibo</god>
  </>;
  var xmlListCopy = xmlList.copy();
  alert(xmlListCopy);
  /* shows
  '<god>Kibo</god>
   <god>Xibo</god>'
  */
  alert(xmlListCopy == xmlList); // shows 'true'
  alert(xmlListCopy === xmlList); // shows 'false'
  alert(xmlListCopy[0] == xmlList[0]); // shows 'true'
  alert(xmlListCopy[0] === xmlList[0]); // shows 'false'