If I have an html element and I clone it how do I compare the original and the clone to test that they are identical?
I'm looking for a way to either test if the two elements are identical or if one element is a clone of another.
No jQuery solutions please.
Here is a live example where I want the function isCloneOf() to return true;
My specific use case:
I'm trying to write a unit test that tests whether a method is inserting a clone of a specific element into the DOM.
I have an array of nodes that are not in the DOM and the method I am testing needs to take a specific node from that array and insert it into a specific place in the DOM. I want to test that the node that is inserted is a clone of the correct node from the array.
The easy way would be to just assign a unique data- attribute to the node and check for that on the clone. But I would like to know if it is possible to actually compare the two nodes.
Aucun commentaire:
Enregistrer un commentaire