]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
don't include data-content/data-title as specifications for options in twipsy/popover
authorJacob Thornton <jacobthornton@gmail.com>
Sun, 6 Nov 2011 21:49:00 +0000 (13:49 -0800)
committerJacob Thornton <jacobthornton@gmail.com>
Sun, 6 Nov 2011 21:49:00 +0000 (13:49 -0800)
docs/javascript.html
js/bootstrap-popover.js
js/bootstrap-twipsy.js

index 82dcffba75724f91937073bfd2805efb998e5e7f..6d67010705b4ca838d42acf7eff6caa5dd8d91e4 100644 (file)
@@ -677,7 +677,7 @@ $('#.tabs').bind('change', function (e) {
                <td>content</td>
                <td>string, function</td>
                <td>'data-content'</td>
-               <td>a string or method for retrieving content text. if none are provided, content will be sourced from a data-content attribute.</td>
+               <td>attribute or method for retrieving content text.</td>
              </tr>
              <tr>
                <td>trigger</td>
index cf6dadf0a5e6e5fd606bf773e05856525e83feb3..c6377841574180408e41d74ea7f7040321033cf4 100644 (file)
        , o = this.options
 
       if (typeof this.options.content == 'string') {
-        content = this.options.content
+        content = $e.attr(this.options.content)
       } else if (typeof this.options.content == 'function') {
         content = this.options.content.call(this.$element[0])
       }
+
       return content
     }
 
 
   $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
     placement: 'right'
+  , content: 'data-content'
   , template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
   })
 
+  $.fn.twipsy.rejectAttrOptions.push( 'content' )
+
 }( window.jQuery || window.ender );
\ No newline at end of file
index e249c815d714fcb67b5671824d35fe9af03c6aea..5ebbddd675d2f7763048f32061072bdd84250b0d 100644 (file)
   , template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
   }
 
+  $.fn.twipsy.rejectAttrOptions = [ 'title' ]
+
   $.fn.twipsy.elementOptions = function(ele, options) {
-    return $.extend({}, options, $(ele).data())
+    var data = $(ele).data()
+      , rejects = $.fn.twipsy.rejectAttrOptions
+      , i = rejects.length
+
+    while (i--) {
+      delete data[rejects[i]]
+    }
+
+    return $.extend({}, options, data)
   }
 
 }( window.jQuery || window.ender );
\ No newline at end of file