• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Coding standards

This version was saved 15 years, 1 month ago View current version     Page history
Saved by Todd Parker
on April 1, 2009 at 9:06:14 am
 
NOTE:  Content from the old Development page has been ported into this page to avoid any confusion. This page is in-progress and we'll be making additions frequently so please check back for updates. Please note any questions or claifications here so they can be answered.

 

General Guidelines

 

  • No browser checks (unless completely necessary) - use jQuery.support instead
  • Plugins must work regardless of what options are passed to init.  All options are truly optional and may be changed at any time.
  • Use jQuery.ui.keyCode for all keyboard events.
  • Do not abbreviate variable names; the bytes will be saved when compressed.
  • Use curly braces for all if statements.
  • do not modify options that a user passes in, except when they are used to reflect the state of the plugin
  • all default values must be explicit
  • no default value should be undefined. At the least it should be null or false

 

 

.noConflict() compliance

 

Wrap plugins in a closure that passes jQuery in as a parameter.  Inside the closure, only reference jQuery through the parameter variable.

 

(function($) {

     // inside here only reference $, not jQuery

})(jQuery);

 

 

passing elements as options or parameters

 

Whenever a user can specify an element, they should be able to provide any of the following:

  • DOMElement
  • array of DOMElement's
  • jQuery object
  • function that returns any of the above
    • Is there a common set of parameters that would be passed to this function?
    • Is there a common context that would be set for this function?

 

getting/setting options after init

 

add notes about how to listen to options

 

callbacks

 

add notes about how to trigger callbacks and what to pass in the ui object

 

specifying icons

 

add notes about how to specify which icons to use, e.g., which close icon.

 

specifying events

 

add notes about how to specify which events should trigger an action

- click, ctrl+click, mouseover

 

applying CSS classes

 

- applying hover states

- applying focus states

Comments (0)

You don't have permission to comment on this page.