forked from jquery/jquery
-
Notifications
You must be signed in to change notification settings - Fork 0
API design guidelines
Dave Methvin edited this page Nov 10, 2015
·
8 revisions
jQuery Core project guidelines:
- Provide a set of APIs that work consistently across supported browsers.
- Document exceptions where consistency is impractical or impossible.
- Work with browser makers to make the web platform behave consistently.
jQuery API guidelines:
- Avoid Boolean traps. - In particular, there should never be more than one Boolean value in an API signature.
-
Avoid global state. - APIs such as
jQuery.ajaxSetup()affect behavior globally, making it difficult for a plugin author to depend on default values. - Undocumented inputs result in unpredictable output. - The API may throw an error inside jQuery, do nothing, or have some unpredictable behavior. This may change without warning across versions, even minor patches.
- Use
.api(name)for getters and.api(name, value)for setters. - A getter on an empty jQuery collection returns
undefined.