Today, I'd like to come back to a very frequent, even almost systematic bad habit of many developers: systematically embed JQuery in their projects.
Often, the only use made is in DOM manipulation, or even querying DOM nodes. Translation: the developer uses JQuery to do a $('.myClass') and retrieve the array of elements before applying treatments to it.
So I would like us to consider several things:
- The weight of a page and its resources has an impact on the loading time of a page. Embedding JQuery (32kB minified and gzipped) will not be painless, especially on mobile web.
- Loading time has an impact on the transformation performance and therefore the objectives set on a web service.
- The second point of attention is the processing time of the requested operations. It is obvious that JQuery being an overlay, it provides a multitude of diverse and varied cases which can make it take longer to execute than instructions written directly in Javascript (Vanilla).
So remember that there are HTML5 APIs available natively in JavaScript and that they meet many of the needs traditionally handled with JQuery. I am thinking in particular of querySelector or at the fetch api.
Yann Cadoret, Founder JS-Republic
[separator type=”” size=”” icon=”star”] [actionbox color=”default” title=”” description=”JS-REPUBLIC is a service company specializing in JavaScript development. We are an approved training center. Find all our technical training on our partner site dedicated to Training” btn_label=”Our training” btn_link=”http://training.ux-republic.com” btn_color=”primary” btn_size=”big” btn_icon=”star” btn_external =”1″]
