Description
From #1704:
@staabm
:
we should use .one()[1] to fix that TODO. but this will also not clear the event listener on destroy
me
:
we should use .one()[1] to fix that TODO.
I think it's the same as using.off( ... ).on( ... )
but more readable.
It's not equivalent tooff( ... ).on( ... )
in the use case ofequalTo
rule. The event should still there in order to validate the element (whichequalTo
rule was attached to) after every focus out of the target.
IMO, the goal of that TODO is to bind the event once for all without unbinding it every time.
Anyway, until there is a better solution, using.one( ... )
makes more sense herebut this will also not clear the event listener on destroy
We have to add it, then.
The problem here is, every time the element was validated, the event was (un)binding from|to target
.
Even if we use .one( ... )
, the only benefit is making the code more readable and simple.
//Cc @staabm