From 0f63538e7656ad5c538a84007a4295de0d0e61d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=80=E1=85=A7=E1=86=BC?= =?UTF-8?q?=E1=84=90=E1=85=A2?= Date: Thu, 27 Mar 2025 17:53:00 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A0=8C=EB=8D=94=EB=A7=81=20=EC=B6=A9?= =?UTF-8?q?=EB=8F=8C=20=EA=B4=80=EB=A0=A8=20=EC=BA=90=EC=8B=B1=20=EB=8B=A4?= =?UTF-8?q?=EC=8B=9C=20=EC=B6=94=EA=B0=80=20(..)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/tts/TTSPiece.es6 | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/common/tts/TTSPiece.es6 b/src/common/tts/TTSPiece.es6 index b41a823..45eef8e 100644 --- a/src/common/tts/TTSPiece.es6 +++ b/src/common/tts/TTSPiece.es6 @@ -129,9 +129,24 @@ export default class TTSPiece { valid = false; break; } - if (el && el.nodeType === Node.ELEMENT_NODE && el.innerText.trim().length === 0) { - valid = false; - break; + if (el && el.nodeType === Node.ELEMENT_NODE) { + if (el._cachedEmptyState !== undefined) { + if (el._cachedEmptyState === true) { + valid = false; + break; + } + } else { + try { + const isEmpty = el.innerText.trim().length === 0; + el._cachedEmptyState = isEmpty; + if (isEmpty) { + valid = false; + break; + } + } catch (e) { + el._cachedEmptyState = false; + } + } } // 이미지, 독음(후리가나)과 첨자는 읽지 않는다 if (!(valid = (['RT', 'RP', 'SUB', 'SUP', 'IMG'].indexOf(el.nodeName) === -1))) {