bootstrap3.x popover报错Cannot read property 'off' of null

最近在使用bootstrap3x的popover实现openlayer的弹出框的时候,控制台总是报错:Cannot read property ‘off’ of null或者Cannot read property ‘trigger’ of null。
根据我的理解,改源码的complete方法和destroy方法(tooltip.js第633行和tooltip.js第380行):

      var complete = function () {
        var prevHoverState = that.hoverState
        null!=that.$element && that.$element.trigger('shown.bs.' + that.type)//380
        that.hoverState = null

        if (prevHoverState == 'out') that.leave(that)
      }
	
		  Tooltip.prototype.destroy = function () {
	    var that = this
	    clearTimeout(this.timeout)
	    this.hide(function () {
	      null!=that.$element && that.$element.off('.' + that.type).removeData('bs.' + that.type)//633
	      if (that.$tip) {
	        that.$tip.detach()
	      }
	      that.$tip = null
	      that.$arrow = null
	      that.$viewport = null
	      that.$element = null
	    })
	  }

你可能感兴趣的:(JavaScript)