Front-end style guide

From OpenHatch wiki
Revision as of 19:36, 25 August 2011 by imported>Paulproteus (moved Dynamic HTML style guide to Front-end style guide: Let's use terms not from 1999)

This is how the OpenHatch dynamic HTML avoids common problems.

Note that the OpenHatch code does not yet follow this guide. It ought to. Perhaps it can be a release goal in the future.

If it's not a link, don't make it a link

If there's no fallback for non-JS users, don't use the <A> tag.

http://openhatch.org/bugs/issue478 covered a problem where a user was clicking on what appeared to be a link. However,

Don't rely on "return false;"

It is easy to mistakenly use "return false;" at the end of a JavaScript callback when you really mean event.preventDefault(). You can read more about this problem.