Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console error while using BVTooltips in IE11 - Object doesn't support property or method 'contains' #4074

Closed
ekilin opened this issue Sep 11, 2019 · 6 comments · Fixed by #4075, mariazevedo88/hash-generator-js#4, mariazevedo88/hash-generator-js#11 or tghelere/CL#8

Comments

@ekilin
Copy link

@ekilin ekilin commented Sep 11, 2019

Error while using tooltips

In IE11 "document.contains" is not supported. Should be replaced with "document.body.contains". Could you please correct this?

Code snippet

In bv-tooltip.js the following code is causing the console error:

    this.$nextTick(() => {
      const target = this.getTarget()
      if (target && document.contains(target)) {
        // Copy the parent's scoped style attribute
        this.scopeId = getScopId(this.$parent)
        // Set up all trigger handlers and listeners
        this.listen()
      } else {
        /* istanbul ignore next */
        warn(`${this.templateType} unable to find target element in document`)
      }
    })

Versions

Libraries:

  • BootstrapVue: 2.0.0
  • Bootstrap: 4.3.1
  • Vue: 2.5.2

Environment:

  • Browser: IE11
@tmorehouse
Copy link
Member

@tmorehouse tmorehouse commented Sep 11, 2019

Thanks for finding this... we should have it fixed in v2.0.1 (hopefully coming out later this week)

@ekilin
Copy link
Author

@ekilin ekilin commented Sep 11, 2019

Thanks a lot!

@ReneS1991
Copy link

@ReneS1991 ReneS1991 commented Sep 11, 2019

Great to hear a fix will be included soon. We use it in one of our projects for which we have a release next week so would be more than great if v2.0.1 can be released this week 😄

jacobmllr95 added a commit that referenced this issue Sep 11, 2019
…r IE11 support (fixes #4074) (#4075)

* fix(tooltip, popover): check `document.body` instead of `document` for IE11 support (fixes #4074)

* lint
@ReneS1991
Copy link

@ReneS1991 ReneS1991 commented Sep 16, 2019

All worked in 2.0.1, thanks! 😄 👍

@jaeming
Copy link

@jaeming jaeming commented Nov 21, 2019

I think this bug must have entered back in at some point. I had to manually polyfill to get tooltips working on IE11:

  document.contains = Element.prototype.contains = function contains(node) {
    do {
      if (this === node) return true
    } while ((node = node && node.parentNode))
    return false
  }

@tmorehouse
Copy link
Member

@tmorehouse tmorehouse commented Nov 21, 2019

@jaeming are you using the latest version of BootstrapVue (v2.1.0)? If so, can you create a new issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment