Skip to content

Commit 7760d7f

Browse files
author
Francis Champagne
committed
Revert "Add a class for "all loaded""
This reverts commit 32245a0.
1 parent 32245a0 commit 7760d7f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

hooks/useFontListener.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useMemo, useRef, useState } from "react"
1+
import React, { useEffect, useMemo, useRef, useState } from "react"
22
import { kebabCase } from "../utils"
33

44
declare var document: { fonts: any }
@@ -33,7 +33,6 @@ export const useFontListener: fontListenerHook = ({
3333
() => (scope === "html" ? "documentElement" : "body"),
3434
[scope]
3535
)
36-
const targetElementClassList = document[targetElement].classList
3736

3837
const apiAvailable = "fonts" in document
3938

@@ -68,7 +67,7 @@ export const useFontListener: fontListenerHook = ({
6867
}
6968

7069
function addClassName(fontName) {
71-
targetElementClassList.add(`wf-${kebabCase(fontName)}--loaded`)
70+
document[targetElement].classList.add(`wf-${kebabCase(fontName)}--loaded`)
7271
}
7372

7473
function isFontLoaded() {
@@ -104,7 +103,6 @@ export const useFontListener: fontListenerHook = ({
104103

105104
if (allFontsLoaded) {
106105
setHasLoaded(true)
107-
targetElementClassList.add(`wf-all--loaded`)
108106
}
109107
}
110108
}

0 commit comments

Comments
 (0)