I have 2 node sets like thus:
var node1 = "<p><img src='src1' /> some text text text <span><img src='img2' /> other text</span><img src='img3' /></p>";
var node2 = "<p><img src='src1' /> some text text text <span>other text</span></p>";
I am trying to find out a way of matching the 2 node sets and removing duplicates from within the P node, so it brings back the resulting node set of.
var result = "<p><span><img src='img2' /></span><img src='img3' /></p>"
Currently I have tried to use jQuerys clone function with:
$(node1).clone().html($(node1).html().replace($(node2).html(), ''))
This returns the original node1 string without removing or replacing any node sets.
I have also attempted a split function converting the html into a string but that got messy real quick, does anyone know any efficient methods for achieving a complex node search/remove duplicates?
` in `
` seperate in the DOM tree ( in chrome anyway ), so I removed one. if you're expecting a `
` inside the content, don't use one as the parent element (use a `