jQuery Common Coding tips:
1, less code by chain coding
2, Use data method instead of storing data inside the DOM.
$('selector').data('meaningfullname', 'this is the data I am storing');
// then later getting the data with
$('selector').data('meaningfullname');
3, If you are Manipulating the DOM a lot, use livequery.(1.3)
$('div.edit').livequery('click', function(){
//go into edit mode
});
4, Use classes as flags:With jQuery you can add a class with the addClass method and then check later if an element has the class with the hasClass method.
5, use same function name to handle different arguments
6, pass options for configuration data
7, test your code by screw.unit
8, make most jQuery code into resuable plugins
jQuery plugin pattern tips:
(from: http://www.learningjquery.com/2007/10/a-plugin-development-pattern)
1. Claim only a single name in the jQuery namespace
2. Accept an options argument to control plugin behavior
3. Provide public access to default plugin settings
4. Provide public access to secondary functions (as applicable)
5. Keep private functions private
6. Support the Metadata Plugin
分享到:
相关推荐
C++ Gotchas Avoiding Common Problems in Coding and Design 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
Verilog and system verilog学习的好资料, Verilog and SystemVerilog Gotchas_101 Common Coding Errors and How to Avoid Them
"processing-creative coding and computational art" 提供了深入学习Processing及其在创意领域应用的资源。 Processing的起源可以追溯到2001年,由Ben Fry和Casey Reas共同创建,旨在让非计算机科学背景的人也能...
Introduction To Digital Audio Coding And Standards
Network Coding and Subspace Designs 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
and more than 200 illustrations of code structures, encoding and decoding circuits and error performance of many important codes and error control coding systems. Appropriate for those with minimum ...
and more than 200 illustrations of code structures, encoding and decoding circuits and error performance of many important codes and error control coding systems. Appropriate for those with minimum ...
The Coding Group consists of enthusiastic research students, research and teaching staff members providing a very stimulating environment to work. Also being driven by academic research, a ...
Software Development, Design and Coding With Patterns, Debugging, Unit Testing, and Refactoring 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索...
Next-Generation Video Coding and Streaming 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权...
Alibaba Java Coding Guidelines pmd implements and IDE plugin
HEVC,即高效视频编码(High Efficiency Video Coding),是一种先进的视频编解码标准,也称为H.265。它是继H.264或AVC(高级视频编码)之后,由国际电信联盟(ITU-T)视频编码专家小组(VCEG)和ISO/IEC动态图像...
Three-dimensional (3D) audiovisual content is nowadays the driving force of many multimedia applications and services as well as development of different support technologies. The recent evolution of ...
Hands-On Game Development without Coding: Create 2D and 3D games with Visual Scripting in Unity by Lucas Bertolini English | 2018 | ISBN: 1789538335 | 430 Pages | EPUB | 102 MB Develop your own games...
《BS ISO_IEC 23008-2-2015信息技术 高效编码与媒体》标准,也被称为HEVC(High Efficiency Video Coding)或H.265,是现代视频编码技术的重要里程碑。这项标准是国际标准化组织(ISO)和国际电工委员会(IEC)共同...
proteins and this small coding capacity demands proteins and this small coding capacity demands proteins and this small coding capacity demands proteins and this small coding capacity demands proteins...