aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2011-11-06 13:49:00 -0800
committerJacob Thornton <[email protected]>2011-11-06 13:49:00 -0800
commitb15e24e3d460ef2cbe20f13c648b42024be096fa (patch)
treeeb6e2baa525cfd12b6a720a484d32d250aa42411
parentc3c700fd02dc1fbd096bd5926960dd9b80b8169d (diff)
downloadbootstrap-b15e24e3d460ef2cbe20f13c648b42024be096fa.tar.xz
bootstrap-b15e24e3d460ef2cbe20f13c648b42024be096fa.zip
don't include data-content/data-title as specifications for options in twipsy/popover
-rw-r--r--docs/javascript.html2
-rw-r--r--js/bootstrap-popover.js6
-rw-r--r--js/bootstrap-twipsy.js12
3 files changed, 17 insertions, 3 deletions
diff --git a/docs/javascript.html b/docs/javascript.html
index 82dcffba7..6d6701070 100644
--- a/docs/javascript.html
+++ b/docs/javascript.html
@@ -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>
diff --git a/js/bootstrap-popover.js b/js/bootstrap-popover.js
index cf6dadf0a..c63778415 100644
--- a/js/bootstrap-popover.js
+++ b/js/bootstrap-popover.js
@@ -51,10 +51,11 @@
, 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
}
@@ -80,7 +81,10 @@
$.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
diff --git a/js/bootstrap-twipsy.js b/js/bootstrap-twipsy.js
index e249c815d..5ebbddd67 100644
--- a/js/bootstrap-twipsy.js
+++ b/js/bootstrap-twipsy.js
@@ -304,8 +304,18 @@
, 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