WebDev:FrontendCodeStandards: Difference between revisions

Line 308: Line 308:
** No inline CSS & JS unless absolutely necessary
** No inline CSS & JS unless absolutely necessary
** Progressive enhancement (see bolded QA requirements)
** Progressive enhancement (see bolded QA requirements)
** More?
* HTML:
* HTML:
** XHTML 1.0 strict doctype (we might want to move to HTML 4.01 strict if we are serving XHTML as html/text)
** HTML5 doctype. Safe to use for all browsers.
** Pages must validate. Not a strict requirement. Some layouts can't be achieved without a few errors.  
** Pages must validate. Not a strict requirement. Some layouts can't be achieved without a few errors.  
** Use most meaningful tags for content
** Use most meaningful tags for content
** Images/bg images with text in them must have alternate textual representation (alt text or text positioned offscreen for screenreaders).  Avoid these due to L10n difficulties anyway.
** Images/bg images with text in them must have alternate textual representation (alt text or text positioned offscreen for screenreaders).  Avoid these due to L10n difficulties anyway.
** More?
* CSS:
* CSS:
** No separate stylesheets for any browser and no conditional statements.
** No separate stylesheets for any browser and no conditional statements.
Line 330: Line 328:
** Specify in comments the scope of generic sounding class names (what does .block mean and where is it applied? one page or multiple pages?)
** Specify in comments the scope of generic sounding class names (what does .block mean and where is it applied? one page or multiple pages?)
*** Try avoiding generic class names altogether
*** Try avoiding generic class names altogether
** More?
* JS
* JS
** Don't pollute the global namespace (put all functions into objects/closures)
** Don't pollute the global namespace (put all functions into objects/closures)
Line 340: Line 337:
** var your variables
** var your variables
** Use JSlint : http://www.jslint.com/
** Use JSlint : http://www.jslint.com/
** More?


=== Performance Standards ===
=== Performance Standards ===
975

edits