Skip to content

Commit

Permalink
fix(b-tooltip/b-popover): add SVGElement as acceptable prop type (c…
Browse files Browse the repository at this point in the history
…loses #4173) (#4174)
  • Loading branch information
tmorehouse authored Sep 30, 2019
1 parent e6c39c4 commit fab7fea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/tooltip/helpers/bv-popper.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Vue from '../../../utils/vue'
import Popper from 'popper.js'
import { getCS, select } from '../../../utils/dom'
import { HTMLElement } from '../../../utils/safe-types'
import { HTMLElement, SVGElement } from '../../../utils/safe-types'
import { BVTransition } from '../../../utils/bv-transition'

const NAME = 'BVPopper'
Expand Down Expand Up @@ -51,7 +51,7 @@ export const BVPopper = /*#__PURE__*/ Vue.extend({
props: {
target: {
// Element that the tooltip/popover is positioned relative to
type: HTMLElement,
type: [HTMLElement, SVGElement],
default: null
},
placement: {
Expand Down
4 changes: 2 additions & 2 deletions src/components/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import getScopId from '../../utils/get-scope-id'
import { isArray, arrayIncludes } from '../../utils/array'
import { getComponentConfig } from '../../utils/config'
import { isString, isUndefinedOrNull } from '../../utils/inspect'
import { HTMLElement } from '../../utils/safe-types'
import { HTMLElement, SVGElement } from '../../utils/safe-types'
import { BVTooltip } from './helpers/bv-tooltip'

const NAME = 'BTooltip'
Expand All @@ -24,7 +24,7 @@ export const BTooltip = /*#__PURE__*/ Vue.extend({
target: {
// String ID of element, or element/component reference
// Or function that returns one of the above
type: [String, HTMLElement, Function, Object],
type: [String, HTMLElement, SVGElement, Function, Object],
// default: undefined,
required: true
},
Expand Down
6 changes: 5 additions & 1 deletion src/utils/safe-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { hasWindowSupport } from './env'

const w = hasWindowSupport ? window : {}

export const HTMLElement = hasWindowSupport ? w.HTMLElement : class HTMLElement extends Object {}
export const Element = hasWindowSupport ? w.Element : class Element extends Object {}

export const HTMLElement = hasWindowSupport ? w.HTMLElement : class HTMLElement extends Element {}

export const SVGElement = hasWindowSupport ? w.SVGElement : class SVGElement extends Element {}

export const File = hasWindowSupport ? w.File : class File extends Object {}

0 comments on commit fab7fea

Please sign in to comment.