Skip to content

API design guidelines

Dave Methvin edited this page Nov 7, 2015 · 8 revisions

jQuery Core tenets:

  • Provide a set of APIs that work consistently across supported browsers.
  • Document exceptions where consistency is impractical or impossible.
  • Work with browser makers to the web platform behave consistently.

jQuery API tenets:

  • Avoid Boolean traps.
  • 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.

Clone this wiki locally