0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-13 01:08:58 +01:00
Bootstrap/docs/assets/js
Mark Otto 7d8d5c7838 Merge branch '2.3.0-wip' into 3.0.0-wip
Conflicts:
	Makefile
	README.md
	component.json
	docs/assets/css/bootstrap-responsive.css
	docs/assets/css/bootstrap.css
	docs/assets/js/bootstrap-affix.js
	docs/assets/js/bootstrap-alert.js
	docs/assets/js/bootstrap-button.js
	docs/assets/js/bootstrap-carousel.js
	docs/assets/js/bootstrap-collapse.js
	docs/assets/js/bootstrap-dropdown.js
	docs/assets/js/bootstrap-modal.js
	docs/assets/js/bootstrap-popover.js
	docs/assets/js/bootstrap-scrollspy.js
	docs/assets/js/bootstrap-tab.js
	docs/assets/js/bootstrap-tooltip.js
	docs/assets/js/bootstrap-transition.js
	docs/assets/js/bootstrap-typeahead.js
	docs/assets/js/bootstrap.js
	docs/components.html
	docs/css.html
	docs/examples/fluid.html
	docs/extend.html
	docs/getting-started.html
	docs/index.html
	docs/templates/pages/base-css.mustache
	docs/templates/pages/components.mustache
	docs/templates/pages/extend.mustache
	docs/templates/pages/getting-started.mustache
	docs/templates/pages/index.mustache
	docs/templates/pages/javascript.mustache
	js/bootstrap-affix.js
	js/bootstrap-alert.js
	js/bootstrap-button.js
	js/bootstrap-carousel.js
	js/bootstrap-collapse.js
	js/bootstrap-dropdown.js
	js/bootstrap-modal.js
	js/bootstrap-popover.js
	js/bootstrap-scrollspy.js
	js/bootstrap-tab.js
	js/bootstrap-tooltip.js
	js/bootstrap-transition.js
	js/bootstrap-typeahead.js
	less/bootstrap.less
	less/buttons.less
	less/forms.less
	less/navbar.less
	less/popovers.less
	less/responsive-767px-max.less
	less/responsive.less
	less/tables.less
	less/tooltip.less
	less/type.less
	less/variables.less
	package.json
2013-01-13 04:26:52 -08:00
..
google-code-prettify pre font-size increase; revert static top navbar, undo contents section for now 2012-08-19 23:01:24 -07:00
holder Update Holder.js 1.6 to 1.9 2013-01-12 19:49:15 -08:00
application.js data-toggle instead of rel for tooltip and popover 2012-12-23 06:51:46 -05:00
bootstrap-affix.js Version bump 2012-12-22 16:10:06 -08:00
bootstrap-alert.js Version bump 2012-12-22 16:10:06 -08:00
bootstrap-button.js Version bump 2012-12-22 16:10:06 -08:00
bootstrap-carousel.js Merge branch '2.3.0-wip' into 3.0.0-wip 2013-01-13 04:26:52 -08:00
bootstrap-collapse.js Merge branch '2.3.0-wip' into 3.0.0-wip 2013-01-13 04:26:52 -08:00
bootstrap-dropdown.js Merge branch '2.3.0-wip' into 3.0.0-wip 2013-01-13 04:26:52 -08:00
bootstrap-modal.js Version bump 2012-12-22 16:10:06 -08:00
bootstrap-popover.js Merge branch '2.3.0-wip' into 3.0.0-wip 2013-01-13 04:26:52 -08:00
bootstrap-scrollspy.js Merge branch '2.3.0-wip' into 3.0.0-wip 2013-01-13 04:26:52 -08:00
bootstrap-tab.js Version bump 2012-12-22 16:10:06 -08:00
bootstrap-tooltip.js Merge branch '2.3.0-wip' into 3.0.0-wip 2013-01-13 04:26:52 -08:00
bootstrap-transition.js Version bump 2012-12-22 16:10:06 -08:00
bootstrap-typeahead.js Merge branch '2.3.0-wip' into 3.0.0-wip 2013-01-13 04:26:52 -08:00
bootstrap.js Merge branch '2.3.0-wip' into 3.0.0-wip 2013-01-13 04:26:52 -08:00
bootstrap.min.js Nuke .popover-inner from the JS since we nuked it from the CSS/HTML long ago 2013-01-10 18:51:04 -08:00
jquery.js added support for jquery 1.8.* 2012-09-20 16:23:54 -07:00
README.md Fixing various spelling typos in the docs. 2012-11-02 16:34:21 -06:00

2.0 BOOTSTRAP JS PHILOSOPHY

These are the high-level design rules which guide the development of Bootstrap's plugin apis.


DATA-ATTRIBUTE API

We 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 'data-api'. This looks like this:

$('body').off('.data-api')

To target a specific plugin, just include the plugins name as a namespace along with the data-api namespace like this:

$('body').off('.alert.data-api')

PROGRAMMATIC API

We 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.

$(".btn.danger").button("toggle").addClass("fat")

All methods should accept an optional options object, a string which targets a particular method, or null which initiates the default behavior:

$("#myModal").modal() // initialized with defaults
$("#myModal").modal({ keyboard: false }) // initialized with now keyboard
$("#myModal").modal('show') // initializes and invokes show immediately afterqwe2

OPTIONS

Options 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 $.fn.plugin.defaults.

$.fn.modal.defaults = { … }

An options definition should take the following form:

*noun*: *adjective* - describes or modifies a quality of an instance

examples:

backdrop: true
keyboard: false
placement: 'top'

EVENTS

All 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.

show | shown
hide | hidden

CONSTRUCTORS

Each plugin should expose it's raw constructor on a Constructor property -- accessed in the following way:

$.fn.popover.Constructor

DATA ACCESSOR

Each 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:

$('[rel=popover]').data('popover') instanceof $.fn.popover.Constructor

DATA ATTRIBUTES

Data attributes should take the following form:

  • data-{{verb}}={{plugin}} - defines main interaction
  • data-target || href^=# - defined on "control" element (if element controls an element other than self)
  • data-{{noun}} - defines class instance options

examples:

// control other targets
data-toggle="modal" data-target="#foo"
data-toggle="collapse" data-target="#foo" data-parent="#bar"

// defined on element they control
data-spy="scroll"

data-dismiss="modal"
data-dismiss="alert"

data-toggle="dropdown"

data-toggle="button"
data-toggle="buttons-checkbox"
data-toggle="buttons-radio"