I was reading the jQuery documentation and I finally noticed the similarity between the closest
and parents
methods.
He cites the differences between the methods, stating that "they are subtle but significant."
Reading the differences I noticed this detail in the closest
method it will search until it finds the element that corresponds to the selector sent. In the parents
method, it takes all the elements and adds them to a list and then compares them.
Apparently closest
is better looking at performance. That's true? Is there any case that it is better to use parents
?