本文介绍了有人可以评论我的错误修复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用。除了在 svg 元素上使用时,它会完全正常工作,它会断开。经过一些调试,我缩小了问题。在 js 文件中, init 函数如下所示:

I have been using Twitter's Bootstrap Tooltip plugin. This works perfectly fine except that when used on svg elements, it breaks. After some debugging, I narrowed down the problem. In the js file, the init function looks like this:

  , init: function (type, element, options) {
      var eventIn
        , eventOut

      ...

      if (this.options.trigger != 'manual') {
        eventIn  = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
        eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
        this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this))
        this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this))
      }

      ...

    }

我记得SVG-IE 9.0的具体实现有很多问题,所以我做了以下修改:

I remembered there were numerous issues with SVG-IE 9.0 specific implementation so I made the following modifications:

  if (this.options.trigger != 'manual') {
    eventIn  = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
    eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
    var flag = $.browser.msie  && parseInt($.browser.version, 10) === 9
    eventIn = flag ? "mouseover" : eventIn
    eventOut = flag ? "mouseout" : eventOut

    this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this))
    this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this))
  }

这在所有浏览器中正常工作。经过一番搜索,我发现面临同样的问题。我不知道是否有一个更好的方法来修复这个bug,尤其是在阅读了。

And this works fine in all browsers. After some searching, I found that someone else faced the same problem. I am not sure if there is a better way of fixing this bug especially after reading the argument in the link.

改进?

推荐答案

好吧,我可能有一些建议,但最好的事情是去并做一个pull请求,@fat和@mdo一定会看看它,然后合并你的代码,甚至给你反馈。干杯!

Well, I might have some suggestions but the best thing is to go on the bootstrap github and do a pull request and @fat and @mdo will certainly take a look at it before merging your code in and even give you feedback. Cheers!

这篇关于有人可以评论我的错误修复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 09:08
查看更多