Please, avoid jQuery
-
Please refrain from assuming that jQuery is in use, especially when there isn’t much reason for it. For instance, the JS in the file “includes/class-ctn-load-time.php” on line 80, instead of the code:
//ctn loadtime display (function($) { $(document).on('ready', function () { $('.ctn_load_time_in_sec').text(<?php echo $this->load_time; ?> + " seconds"); }); })(jQuery)
It’s better to use vanilla js, which is also more elegant:
//ctn loadtime display document.addEventListener('DOMContentLoaded', () => { let o = document.querySelector('.ctn_load_time_in_sec'); o && (o.textContent =
<?= $this->load_time ?? 'unknown' ?> seconds
); });In any case, thank you for the plugin.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Please, avoid jQuery’ is closed to new replies.