Twitter bootstrap 推特';具有选择器和数据-*属性的s引导popover

Twitter bootstrap 推特';具有选择器和数据-*属性的s引导popover,twitter-bootstrap,selector,popover,twitter-bootstrap-3,Twitter Bootstrap,Selector,Popover,Twitter Bootstrap 3,使用 忽略目标元素中指定的任何数据-*属性。 比如说 $(document).popover({ selector: '.selector' }); 问题是:在委托附件({selector:'.selector'})的情况下,如何使引导考虑数据-*属性 UPD 这是和。3.0.0版不会出现此错误。而不是使用 <a class="selector" title="bla" data-content="some html" data-html="true">link</

使用

忽略目标元素中指定的任何
数据-*
属性。
比如说

$(document).popover({
    selector: '.selector'
});

问题是:在委托附件({selector:'.selector'})的情况下,如何使引导考虑
数据-*
属性

UPD
这是和。3.0.0版不会出现此错误。

而不是使用

<a class="selector" title="bla" data-content="some html" data-html="true">link</a>
如果要使用选择器,则代码如下:

 $(document).popover({
    selector: '.selector'
});


指定选择器时,您正在将数据html值重置回默认值false

因此明确指出:

$('.selector').popover();
在这种情况下,将数据html值设置为true。
数据元素未被使用,因为它们是在初始化时设置的,而不是在元素显示时设置的。对于只对初始化器中的所有集合使用相同选项的选择器,这将不起作用。我不知道这是一只虫子。(更新是的,它是固定的:)

快速修复扩展显示功能并(再次)在此处设置选项:


var tmp=$.fn.popover.Constructor.prototype.show
$.fn.popover.Constructor.prototype.show=函数(){
var$e=此.$element
if(typeof($e.attr('data-html'))!='undefined')this.options.html=($e.attr('data-html')='true'))
if(typeof($e.attr('data-placement'))!='undefined')this.options.placement=$e.attr('data-placement');
/*在此处添加其他选项*/
tmp.呼叫(本);
}
这将适用于Twitter的Bootstrap 2.x和Twitter的Bootstrap 3(RC1)

另见:


注意:如上所述使用CDN时,在关闭popover时会出现JS错误(TypeError:this.remove不是一个函数)请参见:

(1)回答错误(检查)(2)回答错误的问题我需要的正是问题的内容:我需要使用属性切换选项
$('.selector').popover();
$(document).popover({
    selector: '[data-toggle="popover"]',
    html:true
});
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> 
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/js/bootstrap.min.js"></script>
<script>    

var tmp = $.fn.popover.Constructor.prototype.show
$.fn.popover.Constructor.prototype.show = function () {
  var $e = this.$element
  if (typeof($e.attr('data-html')) != 'undefined')this.options.html = ($e.attr('data-html')==='true') 
  if (typeof($e.attr('data-placement')) != 'undefined')this.options.placement = $e.attr('data-placement');
  /* add other options here */
  tmp.call(this);
}