Explorar o código

added data-* attributes to options table, close #297

Emanuele Marchi %!s(int64=11) %!d(string=hai) anos
pai
achega
57152fc955
Modificáronse 2 ficheiros con 44 adicións e 14 borrados
  1. 22 7
      docs/index.jade
  2. 22 7
      index.html

+ 22 - 7
docs/index.jade

@@ -137,6 +137,7 @@ html(lang='en')
             thead
             thead
               tr
               tr
                 th Name
                 th Name
+                th Attribute
                 th Type
                 th Type
                 th Description
                 th Description
                 th Values
                 th Values
@@ -144,34 +145,39 @@ html(lang='en')
             tbody
             tbody
               tr
               tr
                 td state
                 td state
+                td checked
                 td Boolean
                 td Boolean
                 td The checkbox state
                 td The checkbox state
                 td true, false
                 td true, false
-                td 'checked' attribute or true
+                td true
               tr
               tr
                 td size
                 td size
+                td data-size
                 td String
                 td String
                 td The checkbox state
                 td The checkbox state
                 td null, 'mini', 'small', 'normal', 'large'
                 td null, 'mini', 'small', 'normal', 'large'
                 td null
                 td null
               tr
               tr
                 td animate
                 td animate
+                td data-animate
                 td Boolean
                 td Boolean
                 td Animate the switch
                 td Animate the switch
                 td true, false
                 td true, false
                 td true
                 td true
               tr
               tr
+                td disabled
                 td disabled
                 td disabled
                 td Boolean
                 td Boolean
                 td Disable state
                 td Disable state
                 td true, false
                 td true, false
-                td 'disabled' attribute or false
+                td false
               tr
               tr
+                td readonly
                 td readonly
                 td readonly
                 td Boolean
                 td Boolean
                 td Readonly state
                 td Readonly state
                 td true, false
                 td true, false
-                td 'readonly' attribute or false
+                td false
               tr
               tr
                 td indeterminate
                 td indeterminate
                 td Boolean
                 td Boolean
@@ -180,54 +186,63 @@ html(lang='en')
                 td false
                 td false
               tr
               tr
                 td onColor
                 td onColor
+                td data-on-color
                 td String
                 td String
                 td Color of the left side of the switch
                 td Color of the left side of the switch
                 td 'primary', 'info', 'success', 'warning', 'danger', 'default'
                 td 'primary', 'info', 'success', 'warning', 'danger', 'default'
                 td 'primary'
                 td 'primary'
               tr
               tr
                 td offColor
                 td offColor
+                td data-off-color
                 td String
                 td String
                 td Color of the right side of the switch
                 td Color of the right side of the switch
                 td 'primary', 'info', 'success', 'warning', 'danger', 'default'
                 td 'primary', 'info', 'success', 'warning', 'danger', 'default'
                 td 'default'
                 td 'default'
               tr
               tr
                 td onText
                 td onText
+                td data-on-text
                 td String
                 td String
                 td Text of the left side of the switch
                 td Text of the left side of the switch
                 td String
                 td String
                 td 'ON'
                 td 'ON'
               tr
               tr
                 td offText
                 td offText
+                td data-off-text
                 td String
                 td String
                 td Text of the right side of the switch
                 td Text of the right side of the switch
                 td String
                 td String
                 td 'OFF'
                 td 'OFF'
               tr
               tr
                 td labelText
                 td labelText
+                td data-label-text
                 td String
                 td String
                 td Text of the center handle of the switch
                 td Text of the center handle of the switch
                 td String
                 td String
                 td ' '
                 td ' '
               tr
               tr
                 td baseClass
                 td baseClass
+                td data-base-class
                 td String
                 td String
                 td Global class prefix
                 td Global class prefix
                 td String
                 td String
                 td 'bootstrap-switch'
                 td 'bootstrap-switch'
               tr
               tr
                 td wrapperClass
                 td wrapperClass
+                td data-wrapper-class
                 td String | Array
                 td String | Array
                 td Container element class(es)
                 td Container element class(es)
                 td String | Array
                 td String | Array
                 td 'wrapper'
                 td 'wrapper'
               tr
               tr
                 td onInit
                 td onInit
+                td
                 td Function
                 td Function
                 td Callback function to execute on initialization
                 td Callback function to execute on initialization
                 td Function
                 td Function
                 td: pre: code.javascript function(event, state) {}
                 td: pre: code.javascript function(event, state) {}
               tr
               tr
                 td onSwitchChange
                 td onSwitchChange
+                td
                 td Function
                 td Function
                 td Callback function to execute on switch state change
                 td Callback function to execute on switch state change
                 td Function
                 td Function
@@ -338,10 +353,10 @@ html(lang='en')
 
 
           .alert.alert-warning
           .alert.alert-warning
             p
             p
-              | All the options are accepted only using <code>data-*</code> attributes on the input element.<br>
-              | The exceptions are <code>checked</code>, <code>disabled</code> and <code>readonly</code> which are
-              | proprietary input attributes.<br>
-              | There isn't any way to specify the options in JavaScript during initialization.
+              | All the options are accepted only using <code>data-*</code> attributes on the element.<br>
+              | <code>checked</code>, <code>disabled</code> and <code>readonly</code> are exception to the rule, being
+              | default HTML input attributes.<br>
+              | Therefore, there is not any way to specify the options in JavaScript during initialization.
 
 
           table.table.table-bordered.table-striped.table-responsive
           table.table.table-bordered.table-striped.table-responsive
             thead
             thead

+ 22 - 7
index.html

@@ -121,6 +121,7 @@
             <thead>
             <thead>
               <tr>
               <tr>
                 <th>Name</th>
                 <th>Name</th>
+                <th>Attribute</th>
                 <th>Type</th>
                 <th>Type</th>
                 <th>Description</th>
                 <th>Description</th>
                 <th>Values</th>
                 <th>Values</th>
@@ -130,13 +131,15 @@
             <tbody>
             <tbody>
               <tr>
               <tr>
                 <td>state</td>
                 <td>state</td>
+                <td>checked</td>
                 <td>Boolean</td>
                 <td>Boolean</td>
                 <td>The checkbox state</td>
                 <td>The checkbox state</td>
                 <td>true, false</td>
                 <td>true, false</td>
-                <td>'checked' attribute or true</td>
+                <td>true</td>
               </tr>
               </tr>
               <tr>
               <tr>
                 <td>size</td>
                 <td>size</td>
+                <td>data-size</td>
                 <td>String</td>
                 <td>String</td>
                 <td>The checkbox state</td>
                 <td>The checkbox state</td>
                 <td>null, 'mini', 'small', 'normal', 'large'</td>
                 <td>null, 'mini', 'small', 'normal', 'large'</td>
@@ -144,24 +147,27 @@
               </tr>
               </tr>
               <tr>
               <tr>
                 <td>animate</td>
                 <td>animate</td>
+                <td>data-animate</td>
                 <td>Boolean</td>
                 <td>Boolean</td>
                 <td>Animate the switch</td>
                 <td>Animate the switch</td>
                 <td>true, false</td>
                 <td>true, false</td>
                 <td>true</td>
                 <td>true</td>
               </tr>
               </tr>
               <tr>
               <tr>
+                <td>disabled</td>
                 <td>disabled</td>
                 <td>disabled</td>
                 <td>Boolean</td>
                 <td>Boolean</td>
                 <td>Disable state</td>
                 <td>Disable state</td>
                 <td>true, false</td>
                 <td>true, false</td>
-                <td>'disabled' attribute or false</td>
+                <td>false</td>
               </tr>
               </tr>
               <tr>
               <tr>
+                <td>readonly</td>
                 <td>readonly</td>
                 <td>readonly</td>
                 <td>Boolean</td>
                 <td>Boolean</td>
                 <td>Readonly state</td>
                 <td>Readonly state</td>
                 <td>true, false</td>
                 <td>true, false</td>
-                <td>'readonly' attribute or false</td>
+                <td>false</td>
               </tr>
               </tr>
               <tr>
               <tr>
                 <td>indeterminate</td>
                 <td>indeterminate</td>
@@ -172,6 +178,7 @@
               </tr>
               </tr>
               <tr>
               <tr>
                 <td>onColor</td>
                 <td>onColor</td>
+                <td>data-on-color</td>
                 <td>String</td>
                 <td>String</td>
                 <td>Color of the left side of the switch</td>
                 <td>Color of the left side of the switch</td>
                 <td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td>
                 <td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td>
@@ -179,6 +186,7 @@
               </tr>
               </tr>
               <tr>
               <tr>
                 <td>offColor</td>
                 <td>offColor</td>
+                <td>data-off-color</td>
                 <td>String</td>
                 <td>String</td>
                 <td>Color of the right side of the switch</td>
                 <td>Color of the right side of the switch</td>
                 <td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td>
                 <td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td>
@@ -186,6 +194,7 @@
               </tr>
               </tr>
               <tr>
               <tr>
                 <td>onText</td>
                 <td>onText</td>
+                <td>data-on-text</td>
                 <td>String</td>
                 <td>String</td>
                 <td>Text of the left side of the switch</td>
                 <td>Text of the left side of the switch</td>
                 <td>String</td>
                 <td>String</td>
@@ -193,6 +202,7 @@
               </tr>
               </tr>
               <tr>
               <tr>
                 <td>offText</td>
                 <td>offText</td>
+                <td>data-off-text</td>
                 <td>String</td>
                 <td>String</td>
                 <td>Text of the right side of the switch</td>
                 <td>Text of the right side of the switch</td>
                 <td>String</td>
                 <td>String</td>
@@ -200,6 +210,7 @@
               </tr>
               </tr>
               <tr>
               <tr>
                 <td>labelText</td>
                 <td>labelText</td>
+                <td>data-label-text</td>
                 <td>String</td>
                 <td>String</td>
                 <td>Text of the center handle of the switch</td>
                 <td>Text of the center handle of the switch</td>
                 <td>String</td>
                 <td>String</td>
@@ -207,6 +218,7 @@
               </tr>
               </tr>
               <tr>
               <tr>
                 <td>baseClass</td>
                 <td>baseClass</td>
+                <td>data-base-class</td>
                 <td>String</td>
                 <td>String</td>
                 <td>Global class prefix</td>
                 <td>Global class prefix</td>
                 <td>String</td>
                 <td>String</td>
@@ -214,6 +226,7 @@
               </tr>
               </tr>
               <tr>
               <tr>
                 <td>wrapperClass</td>
                 <td>wrapperClass</td>
+                <td>data-wrapper-class</td>
                 <td>String | Array</td>
                 <td>String | Array</td>
                 <td>Container element class(es)</td>
                 <td>Container element class(es)</td>
                 <td>String | Array</td>
                 <td>String | Array</td>
@@ -221,6 +234,7 @@
               </tr>
               </tr>
               <tr>
               <tr>
                 <td>onInit</td>
                 <td>onInit</td>
+                <td></td>
                 <td>Function</td>
                 <td>Function</td>
                 <td>Callback function to execute on initialization</td>
                 <td>Callback function to execute on initialization</td>
                 <td>Function</td>
                 <td>Function</td>
@@ -230,6 +244,7 @@
               </tr>
               </tr>
               <tr>
               <tr>
                 <td>onSwitchChange</td>
                 <td>onSwitchChange</td>
+                <td></td>
                 <td>Function</td>
                 <td>Function</td>
                 <td>Callback function to execute on switch state change</td>
                 <td>Callback function to execute on switch state change</td>
                 <td>Function</td>
                 <td>Function</td>
@@ -348,10 +363,10 @@ $.fn.bootstrapSwitch.defaults.onColor = 'success';</code></pre>
           <h2 class="page-header">Options</h2>
           <h2 class="page-header">Options</h2>
           <div class="alert alert-warning">
           <div class="alert alert-warning">
             <p>
             <p>
-              All the options are accepted only using <code>data-*</code> attributes on the input element.<br>
-              The exceptions are <code>checked</code>, <code>disabled</code> and <code>readonly</code> which are
-              proprietary input attributes.<br>
-              There isn't any way to specify the options in JavaScript during initialization.
+              All the options are accepted only using <code>data-*</code> attributes on the element.<br>
+              <code>checked</code>, <code>disabled</code> and <code>readonly</code> are exception to the rule, being
+              default HTML input attributes.<br>
+              Therefore, there is not any way to specify the options in JavaScript during initialization.
             </p>
             </p>
           </div>
           </div>
           <table class="table table-bordered table-striped table-responsive">
           <table class="table table-bordered table-striped table-responsive">