ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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
تم إضافة السؤال من قبل Mahmoud Manaa , Network Engineer , Zain - Kuwait
تاريخ النشر: 2013/11/04
Clodelio Delfino
من قبل 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
من قبل 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
من قبل Maisnam Raju Singh , web developer , Comnicate

Avoid global namespacing

minification and obfuscation 

 

HAS JA
من قبل HAS JA

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

المزيد من الأسئلة المماثلة