Recommend this page to a friend! |
Classes of william amed | Raptor 2 | web/bundles/bootstrap/js/README.md | Download |
|
Download2.0 BOOTSTRAP JS PHILOSOPHYThese are the high-level design rules which guide the development of Bootstrap's plugin apis. DATA-ATTRIBUTE APIWe believe you should be able to use all plugins provided by Bootstrap purely through the markup API without writing a single line of javascript. We acknowledge that this isn't always the most performant and sometimes it may be desirable to turn this functionality off altogether. Therefore, as of 2.0 we provide the ability to disable the data attribute API by unbinding all events on the body namespaced with
To target a specific plugin, just include the plugins name as a namespace along with the data-api namespace like this:
PROGRAMMATIC APIWe also believe you should be able to use all plugins provided by Bootstrap purely through the JS API. All public APIs should be single, chainable methods, and return the collection acted upon.
All methods should accept an optional options object, a string which targets a particular method, or null which initiates the default behavior:
OPTIONSOptions should be sparse and add universal value. We should pick the right defaults. All plugins should have a default object which can be modified to effect all instance's default options. The defaults object should be available via
An options definition should take the following form:
examples:
EVENTSAll events should have an infinitive and past participle form. The infinitive is fired just before an action takes place, the past participle on completion of the action.
CONSTRUCTORSEach plugin should expose it's raw constructor on a
DATA ACCESSOREach plugin stores a copy of the invoked class on an object. This class instance can be accessed directly through jQuery's data API like this:
DATA ATTRIBUTESData attributes should take the following form:
examples:
|