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 ) );
Whenever a user can specify an element, they should be able to provide any of the following:
TODO: move everything below here to widget factory docs and link to that doc from here.
add notes about how to listen to options
add notes about how to trigger callbacks and what to pass in the ui object
add notes about how to specify which icons to use, e.g., which close icon.
add notes about how to specify which events should trigger an action
- click, ctrl+click, mouseover
- applying hover states
- applying focus states
Widgets that append elements to the page should use the .ui-front stacking technique.
These widgets will have an appendTo option but will not have a zIndex option.
The default for appendTo should be null, which means to walk up the DOM from the associated element looking for an existing element with the ui-front class. For example, the autocomplete widget's menu is appended to the DOM, and walks up from the associated input field.
If an element is found with the ui-front class, the element being appended will be appended to the found element.
If no element is found, the element is appended to the body.
If the user explicitly sets the appendTo option, then no searching is performed and the specified element is used.
The appended element must also have the ui-front class added, which will apply a z-index to the element. The element must also have it's position style set to absolute or fixed by some other class.