From 3ce09a21a4bda5f70d9ccf63cce3730373eba723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B4=AE=E7=94=9F=EF=BC=88=E5=AD=90=E8=99=9A=EF=BC=89?= <2234839456@qq.com> Date: Thu, 9 Apr 2026 12:06:31 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=88=87=E6=8D=A2=E5=AD=97=E4=BD=93?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/webfont-sdk.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/webfont-sdk.js b/public/webfont-sdk.js index d52542f..7836c7f 100644 --- a/public/webfont-sdk.js +++ b/public/webfont-sdk.js @@ -343,12 +343,18 @@ var WebFont = (function () { processText(loader, options.text); + var disposed = false; + return { update: function (text) { + if (disposed) return; processText(loader, text); }, dispose: function () { - /* loadText 不独占样式,样式由 loader 统一管理 */ + if (disposed) return; + disposed = true; + /** 移除该 loader 注入的所有 @font-face 样式,避免同名 family 的 CSS 优先级冲突 */ + destroyLoader(fontKey(fontName, family)); } }; }