Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

What are JavaScript Best practices To Apply to jQuery And JavaScript code?

¡list of things to do, and not to do, when developing JavaScript and jQuery!

user-image
Question ajoutée par Mahmoud Manaa , Network Engineer , Zain - Kuwait
Date de publication: 2013/11/04
Clodelio Delfino
par Clodelio Delfino , Managing Consultant , Startup Company

Just a random JS tips...

1. Optimize selectors for Sizzle’s ‘right to left’ model

$('.class span.class2') - OK

$('#id div.class') - Recommended

 

2. Don’t load code that isn’t needed or until it is needed

3. Load the framework from CDN or better using Google Code

4. Use lazy loading especially from image/s

5. When emptying nodes: always prefer removeNode() over innerHTML = ''

6. Optimising a selectors

$('div.content') Slower

$('#container div.content') Slow

$('#container').find('div.content') Fast

Jonathan de Flaugergues
par Jonathan de Flaugergues , software engineer , Abbeal

The best practice is to not use jQuery.

This library is now useless and deprecated with the last framework as React and Angular.

Maisnam Raju Singh
par Maisnam Raju Singh , web developer , Comnicate

Avoid global namespacing

minification and obfuscation 

 

hello i am hassan this is my new website to learn english,french and arabic languages,grammar vocubulary ....etc ; you can also click beside the phrase to listen to the way the phrase is pronounced by clicking "click ".http://www.nbc01.com/May-Can.phpif you want to compare GDP of many countries you can click this link http://www.nbc01.com/Calculate-GDP.phphttp://www.nbc01.com/Calculate-your-GDP-PER-CAPITA.phpif you want to count the number of occurrence of a word in a text Coran ....etc click this linkhttp://www.nbc01.com/Words-occurrence.phphttp://www.nbc01.com/Words-occurrence.phpAll my regards

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?