Duplicate ID issue
Hi,
I'm trying to call morphdom with fromElem:
<div id="thing">
<div id="thing">
<div class="TableObject border-bottom border-gray-light py-3">
</div>
</div>
</div>
toElem:
<div id="thing"></div
But this doesn't change fromElem at all! It looks the exact same as it was. This is mainly due to there being duplicated ID fields. If I rename either of the thing IDs to say something else, then morphdom correctly works and fromElem is turned into toElem.
Is there a way around this limitation? I understand ID fields should be unique, but a user is passing this HTML to me, and I don't have control over them incorrectly using duplicated IDs.
I saw that I can provide my own unique ID function for morphdom, but I'm not sure how I would generate a unique key in this case?
If there's no way around the limitation, then an alternative would be if morphdom can give me back an error saying that it couldn't morph the fromElem or a notice saying that the fromElem was not changed would be good as well. That way, I could handle this special case of two duplicated IDs myself.
I just ran into a similar situation where morphdom would just keep adding the same element with every morph because of duplicate Ids. I would really appreciate if there could be a warning or exception when duplicate getNodeKey are detected. That would have saved me some time finding and disabling getNodeKey.