7
I was reading the jQuery documentation and I realized the similarity between the methods closest
and parents
.
He cites the differences between the methods, stating that "they are subtle but significant".
Reading the differences I noticed this detail in the method closest
it looks until it finds the element that matches the sent selector. Already in the method parents
, it takes all the elements and adds in a list and then makes the comparison.
Apparently the closest
is better, looking performance. Is that true? Is there any case that is better to use the parents
?
"Better" is a very malleable word.
– Oralista de Sistemas