Lightweight JavaScript
|
|
||
|
Source : http://icant.co.uk
Activity:
0 comments
57 views
last activity : 07 06 2010 20:18:04 +0000
|
||
|
|
One of the most important things to keep in mind when writing JavaScript for the Web is to make it unobtrusive, since You cannot rely on JavaScript being available.
Sadly, there are many developers who do not seem to spend any energy at all on considering how to do that. Instead they choose to blindly forge ahead and assume that everybody who comes visiting will have full support for JavaScript and use a mouse.
Luckily there are a number of web developers who advocate unobtrusive JavaScript. One of the most noticeable ones is "Chris Heilmann", who talks a lot about it in his book Beginning JavaScript with DOM Scripting and Ajax. Recently Chris held a workshop on the subject, and while preparing his materials for the workshop he defined "The seven rules of Unobtrusive JavaScript"
Here are the seven rules mentioned for you:
Do not make any assumptions: Don’t expect JavaScript to be available, and don’t expect the intended markup to be there.
Find your hooks and relationships: Examine the HTML you are working with to find the best way of letting your script interact with it.
Leave traversing to the experts: When possible, let CSS take care of finding the element you want to change.
Understand browsers and users: Don’t deviate too far from the way browsers work and how users expect them to work.
Understand Events: Learn how event handling helps you separate your JavaScript from your HTML.
Play well with others: Make sure your script does not interfere with others, and make it hard for other scripts to interfere with yours.
Work for the next developer: Make maintenance easier by writing logical code with clear variable and function names and commenting where necessary.
It’s all excellent advice that goes beyond unobtrusive scripting and into the realm of general best practices.
I guess no matter which part of web development you look at there will always be people who couldn’t care less about craftsmanship and quality, and are always on the lookout for shortcuts and ways to shut out minorities.
For detailed information and coding, please follow the trackback link provided.
- Create a confidential Career Profile and Resume/C.V. online
- Get advice for planning their career and for marketing of experience and skills
- Maximize awareness of and access to the best career opportunities
|
|
|
|
|
|
|
|
|
|
|
|
I am in support of Rationalised Infrastructure. Our infrastructure is mobile, efficient, and disaster tolerant. Its modular nature allows highly granular control of IT resources with half the energy costs of standard "facilities" and associated... |
BAN, 90% of people go these sites JUST wasting time.These sites must certainly be banned in colleges and university campuses.Students/lectures (young) waste such a hell lot of time doing meaningless stuff over here that its very irritable indeed.... |
Brand positioning creates a specific place in the market for your brand and product offerings. It reaches a certain type of consumer or customer and delivers benefits that meet the needs of several key target groups and users. It may be that Dove... |