]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
allow the use of data attributes to define popover options
authorJacob Thornton <jacobthornton@gmail.com>
Sun, 30 Oct 2011 02:27:02 +0000 (19:27 -0700)
committerJacob Thornton <jacobthornton@gmail.com>
Sun, 30 Oct 2011 02:27:02 +0000 (19:27 -0700)
docs/javascript.html
js/bootstrap-popover.js
js/bootstrap-twipsy.js

index 47edf2b75156c00fd2453d17cb9dfaaec0dd05fe..3aac2a82f8f2263600e8fb5695122581d0f25a0b 100644 (file)
@@ -555,6 +555,8 @@ $('#.tabs').bind('change', function (e) {
              </tr>
             </tbody>
           </table>
+          <p><span class="label notice">Notice</span> Individual twipsy instance options can alternatively be specified through the use of data attributes.</code></p>
+          <pre class="prettyprint linenums">&lt;a href="#" data-placement="below" rel='twipsy' title='Some title text'&gt;text&lt;/a&gt;</pre>
           <h3>Methods</h3>
           <h4>$().twipsy(options)</h4>
           <p>Attaches a twipsy handler to an element collection.</p>
@@ -669,7 +671,7 @@ $('#.tabs').bind('change', function (e) {
                <td>content</td>
                <td>string, function</td>
                <td>'data-content'</td>
-               <td>attribute or method for retrieving content text</td>
+               <td>a string or method for retrieving content text. if none are provided, content will be sourced from a data-content attribute.</td>
              </tr>
              <tr>
                <td>trigger</td>
@@ -679,6 +681,8 @@ $('#.tabs').bind('change', function (e) {
              </tr>
             </tbody>
           </table>
+          <p><span class="label notice">Notice</span> Individual popover instance options can alternatively be specified through the use of data attributes.</code></p>
+          <pre class="prettyprint linenums">&lt;a data-placement="below" href="#" class="btn danger" rel="popover"&gt;text&lt;/a&gt;</pre>
           <h3>Methods</h3>
           <h4>$().popover(options)</h4>
           <p>Initializes popovers for an element collection.</p>
index a8a1d8e7bbcbe8d4844f4d43fc793e2d68757e75..e8f4ce096bed6faf7cb1cc5da9df771f035b776e 100644 (file)
@@ -47,7 +47,7 @@
        , o = this.options
 
       if (typeof this.options.content == 'string') {
-        content = $e.attr(o.content)
+        content = this.options.content
       } else if (typeof this.options.content == 'function') {
         content = this.options.content.call(this.$element[0])
       }
@@ -74,6 +74,6 @@
     return this
   }
 
-  $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { content: 'data-content', placement: 'right'})
+  $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { placement: 'right'})
 
 }( window.jQuery || window.ender );
\ No newline at end of file
index ad2938a1a8e8bd4b1a1a2cd1f8207ac73de6dc9b..f0e5b1b90dd2a743104924f64f9531599c73ee9a 100644 (file)
   }
 
   $.fn.twipsy.elementOptions = function(ele, options) {
-    return $.metadata ? $.extend({}, options, $(ele).metadata()) : options
+    return $.extend({}, options, $(ele).data())
   }
 
 }( window.jQuery || window.ender );
\ No newline at end of file