Delegate () vs on () in jquery?

I know the difference between delegate () and on () , but I have doubts that on () is very popular and faster than delegate () , which is why jquery does not remove delegate()from its library.

live () has flaws and then removed from jQuery-1.9 version. Also, if we see performance between on () and delegate () , then it on()runs much faster than delegate().

Then any reason to save delegate () in jQuery?

+4
source share
5 answers

This is what the jQuery team member wrote regarding this issue in 2013:

" .bind .delegate, , .

, .

.live, , .

, delegate() on(), delegate() - , ( ).

+3

:

jQuery 1.7,.delegate() .on().

. .

+3

, , , ... . ...

.on() not.delegate

+2
source

onDesigned for replacement delegate. Probably, jQuery authors could take some time to make it more backward compatible. Many old plugins still use these methods. probably this may be the reason for its conservation.

+2
source

You can bind and delegate events using the method on(). Just the syntax is different.

Just follow this link:

http://learn.jquery.com/events/handling-events/

They perfectly explained with examples.

+2
source

Source: https://habr.com/ru/post/1535309/


All Articles