mirror of
https://github.com/PuerkitoBio/goquery
synced 2026-04-22 23:37:04 +08:00
c7533ba696
The old implementation used nested loops to check if one of the new nodes was already in the existing nodes. This commit maintains a map[*html.Node]bool so that a single loop over the new elements is required. This is slower for small slices though, and allocates more. The next step is for appendWithoutDuplicates to accept a map as argument so that the set is not recreated on each call from mapNodes.