Swapnil Sharma
Swapnil Sharma

Reputation: 51

javascript clonenode() method is not working with safari

My code is perfectly working with IE but its not working with safari.Clonenode() method is not working in safari . I have a code like this

function ApplyNowWizard_addVehicleTypeList(vehicleDOM) 
{
        oParent = $(this.data).get(0);
        oParent.documentElement.appendChild(vehicleDOM.cloneNode(true).documentElement);
 }

In safari vehicleDOM.cloneNode(true).documentElement give null.

Upvotes: 0

Views: 847

Answers (1)

T.J. Crowder
T.J. Crowder

Reputation: 1075249

As documentElement is a Document field, I assume vehicleDOM must be a Document. Note the DOM specification comment about cloneNode:

And, cloning Document, DocumentType, Entity, and Notation nodes is implementation dependent.

Since what you really want is a clone of the document element anyway, it sounds like you may be better off cloning that rather than the Document:

oParent.documentElement.appendChild(vehicleDOM.documentElement.cloneNode(true));

Upvotes: 2

Related Questions