Skip to content

Commit

Permalink
guard against document.body === null (which happens in Electron)
Browse files Browse the repository at this point in the history
  • Loading branch information
etpinard committed Jul 5, 2018
1 parent ae7d15f commit 0205af8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions index.js
Expand Up @@ -23,12 +23,14 @@ let shaderCache = new WeakMap

// Safari does not support font-stretch
let isStretchSupported = false
let el = document.body.appendChild(document.createElement('div'))
el.style.font = 'italic small-caps bold condensed 16px/2 cursive'
if (getComputedStyle(el).fontStretch) {
isStretchSupported = true
if (document.body) {
let el = document.body.appendChild(document.createElement('div'))
el.style.font = 'italic small-caps bold condensed 16px/2 cursive'
if (getComputedStyle(el).fontStretch) {
isStretchSupported = true
}
document.body.removeChild(el)
}
document.body.removeChild(el)

class GlText {
constructor (o) {
Expand Down

0 comments on commit 0205af8

Please sign in to comment.