Skip to content

Commit

Permalink
fix(ripple): allow getComputedStyle to return null (#6639)
Browse files Browse the repository at this point in the history
The function window.getComputedStyle was returning null under certain conditions on Firefox before version 62, see https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle#Browser_compatibility.
  • Loading branch information
neelance authored and johnleider committed Feb 28, 2019
1 parent 8b45196 commit 0bf395c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/vuetify/src/directives/ripple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const ripple = {
el.appendChild(container)

const computed = window.getComputedStyle(el)
if (computed.position === 'static') {
if (computed && computed.position === 'static') {
el.style.position = 'relative'
el.dataset.previousPosition = 'static'
}
Expand Down Expand Up @@ -200,7 +200,8 @@ function directive (el: HTMLElement, binding: VNodeDirective, node: VNode) {

// warn if an inline element is used, waiting for el to be in the DOM first
node.context && node.context.$nextTick(() => {
if (window.getComputedStyle(el).display === 'inline') {
const computed = window.getComputedStyle(el)
if (computed && computed.display === 'inline') {
const context = (node as any).fnOptions ? [(node as any).fnOptions, node.context] : [node.componentInstance]
consoleWarn('v-ripple can only be used on block-level elements', ...context)
}
Expand Down

0 comments on commit 0bf395c

Please sign in to comment.