Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Thornton <jacobthornton@gmail.com>2011-12-21 11:28:48 +0400
committerJacob Thornton <jacobthornton@gmail.com>2011-12-21 11:28:48 +0400
commitf72a94ae2879ebfc5206dd40d5db175e13113850 (patch)
tree449059333026de02121df08ca18bc6fbe6f4d02b /js/README.md
parentc4364285e456013c4b66308fea86e0f1fb852817 (diff)
update more readme changes - introduce target specificty convention to more plugins
Diffstat (limited to 'js/README.md')
-rw-r--r--js/README.md28
1 files changed, 23 insertions, 5 deletions
diff --git a/js/README.md b/js/README.md
index 061509fd3a..04dfb75df6 100644
--- a/js/README.md
+++ b/js/README.md
@@ -1,5 +1,5 @@
## 2.0 BOOTSTRAP JS PHILOSOPHY
-These are the high-level design rules which guide the development of Bootstrap's JS plugins.
+These are the high-level design rules which guide the development of Bootstrap's plugin apis.
---
@@ -28,10 +28,12 @@ All public APIs should be single, chainable methods, and return the collection a
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
---
-### PLUGIN OPTIONS
+### OPTIONS
Options should be sparse and add universal value. We should pick the right defaults.
@@ -51,7 +53,7 @@ examples:
---
-### PLUGIN EVENTS
+### 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.
@@ -60,14 +62,30 @@ All events should have an infinitive and past participle form. The infinitive is
---
+### 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)* - defines main interaction
-- data-target || href^=# - defined on controller element (if element interacts with an element other than self)
-- data-*(noun)* - defines options for element invocation
+- data-target || href^=# - defined on "control" element (if element controls an element other than self)
+- data-*(noun)* - defines class instance options
examples: