Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur791004 committed Feb 27, 2024
1 parent 36a6f97 commit 4274256
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ export async function loadFontFaceInBrowser( fontFace, source, addTo = 'all' ) {
*
* Note that Font faces that were added to the set using the CSS @font-face rule
* remain connected to the corresponding CSS, and cannot be deleted.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/delete.
*/
export function unloadFontFaceInBrowser( fontFace, addTo = 'all' ) {
export function unloadFontFaceInBrowser( fontFace, removeFrom = 'all' ) {
const unloadFontFace = ( fonts ) => {
fonts.forEach( ( f ) => {
if (
Expand All @@ -141,11 +143,11 @@ export function unloadFontFaceInBrowser( fontFace, addTo = 'all' ) {
} );
};

if ( addTo === 'document' || addTo === 'all' ) {
if ( removeFrom === 'document' || removeFrom === 'all' ) {
unloadFontFace( document.fonts );
}

if ( addTo === 'iframe' || addTo === 'all' ) {
if ( removeFrom === 'iframe' || removeFrom === 'all' ) {
const iframeDocument = document.querySelector(
'iframe[name="editor-canvas"]'
).contentDocument;
Expand Down

0 comments on commit 4274256

Please sign in to comment.