Is there a way to keep this dynamic content and not duplicate elements?

Here is my sample Trial.rar (309.1 KB)

At first, before the html is fully loaded, the duplicate has not been generated and the dynamic content is still fine.

After it is fully loaded, the duplicate is generated


As @hua mentioned before, the cause maybe lie in line 525 to 544 of the file

Unfortunately, the dynamic content does not work if I remove these lines. I would like to ask how to disable generating such duplicates. Thank you so much for your help!