From b15e24e3d460ef2cbe20f13c648b42024be096fa Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sun, 6 Nov 2011 13:49:00 -0800 Subject: [PATCH] don't include data-content/data-title as specifications for options in twipsy/popover --- docs/javascript.html | 2 +- js/bootstrap-popover.js | 6 +++++- js/bootstrap-twipsy.js | 12 +++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/javascript.html b/docs/javascript.html index 82dcffba75..6d67010705 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -677,7 +677,7 @@ $('#.tabs').bind('change', function (e) { content string, function 'data-content' - a string or method for retrieving content text. if none are provided, content will be sourced from a data-content attribute. + attribute or method for retrieving content text. trigger diff --git a/js/bootstrap-popover.js b/js/bootstrap-popover.js index cf6dadf0a5..c637784157 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: '

' }) + $.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 e249c815d7..5ebbddd675 100644 --- a/js/bootstrap-twipsy.js +++ b/js/bootstrap-twipsy.js @@ -304,8 +304,18 @@ , template: '
' } + $.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