From 465cea1e02482835fc98b3adf77fd7d35512995a Mon Sep 17 00:00:00 2001 From: Simon He <57086651+Simon-He95@users.noreply.github.com> Date: Wed, 7 Aug 2024 21:41:05 +0800 Subject: [PATCH] fix(isInAttribute): with no attr --- src/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 1231d4ce..ed9d6391 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -573,8 +573,8 @@ export function isInAttribute(child: any, position: any, offset: number) { const startOffset = start.offset const match = child.loc.source.slice(child.tag.length + 1).match('>')! const endOffset = startOffset + match.index - const offset = getOffsetFromPosition(position)! - return (startOffset < offset) && (offset <= endOffset) + const _offset = getOffsetFromPosition(position)! + return (startOffset + offset < _offset) && (_offset <= endOffset + offset) } } }