Skip to content

Commit 1be80e9

Browse files
committed
perf: benchmark regression
1 parent 676d0f7 commit 1be80e9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/tags.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ export const tagHandlers: Record<string, TagHandler> = {
203203
return ''
204204
}
205205
let prefix = ''
206-
// no link was emitting, try and use aria label or title
207-
if (state.buffer[state.buffer.length - 1] === '[') {
206+
// no text children were emitted - should try use fallback
207+
if (!node.childTextNodeIndex) {
208208
prefix = node.attributes?.title || node.attributes?.['aria-label'] || ''
209209
}
210210
const href = resolveUrl(node.attributes?.href || '', state.options?.origin)

src/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,15 @@ export interface Node {
6060

6161
/** Current walk index for child traversal */
6262
currentWalkIndex: number
63+
64+
/** The text child nodes of the parent node */
65+
childTextNodeIndex: number
6366
}
6467

6568
/**
6669
* Parent node that can contain child nodes
6770
*/
6871
export interface ParentNode extends Node {
69-
/** The text child nodes of the parent node */
70-
childTextNodeIndex: number
7172

7273
/** Child nodes (not used in streaming mode) */
7374
children?: Node[]

0 commit comments

Comments
 (0)