Closed jengjeng closed 7 years ago
Thanks for pointing this @jengjeng! I will think about it before merging as I decided to use the “data-api” with the idea that it could be disabled. I have to think a little about it.
@jengjeng can you change the branch to point to develop
instead of master
?
Hi,
How about if we change the ready event to the custom event then we can detach ready event simply by using .off
eg.
$(document).on('checkboxes.data-api.ready', dataApiDomReadyHandler);
$(document).ready(function () {
$(document).trigger('checkboxes.data-api.ready');
});
then
$(document).off('checkboxes.data-api.ready');
Actually, it doesn't matter for the ready event to be namespaced. It would be a race condition trying to turning off an event that run once on DOM ready...
That said, let just use the bit of code you just provided. But instead of using: $(document).ready(fn)
use the recommended one: $(fn)
.
As of jQuery 3.0, only the first syntax is recommended [
$( handler )
]
In the end, we just want something as:
$(dataApiDomReadyHandler);
23
Fix: - JQMIGRATE: 'ready' event is deprecated.