diff --git a/docs/javascript.html b/docs/javascript.html index 90b7be0c53..d62dd731c1 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -683,7 +683,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 128bc54127..e8b49af3c2 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,9 +81,12 @@ $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { placement: 'right' + , content: 'data-content' , template: '

' , titleSelector: '.title' , contentSelector: '.content p' }) + $.fn.twipsy.rejectAttrOptions.push( 'content' ) + }( window.jQuery || window.ender ); diff --git a/js/bootstrap-twipsy.js b/js/bootstrap-twipsy.js index 9eb6e79f4e..24c1ced8c7 100644 --- a/js/bootstrap-twipsy.js +++ b/js/bootstrap-twipsy.js @@ -305,8 +305,18 @@ , contentSelector: '.twipsy-inner' } + $.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 );