I am using the Twitter Bootstrap Tooltip plugin . This works great, except that when using 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)) } ... }
I remembered that there were numerous problems with the implementation of SVG-IE 9.0, so I made the following changes:
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)) }
And it works great in all browsers. After some searching, I found that someone else was facing the same problem. I'm not sure if there is a better way to fix this error, especially after reading the argument in the link .
In IE9, there is a built-in implementation of contains () in the document, so jQuery uses it. The problem is that this contains () the implementation does not apply to SVG elements.
Any suggestions for improving my fix?