Skip to content

fix(core/link-to-dfn): use parentElement.closest() for scoping hint - #5393

Draft
marcoscaceres wants to merge 1 commit into
mainfrom
fix/5257-closest-self-match
Draft

fix(core/link-to-dfn): use parentElement.closest() for scoping hint#5393
marcoscaceres wants to merge 1 commit into
mainfrom
fix/5257-closest-self-match

Conversation

@marcoscaceres

Copy link
Copy Markdown
Contributor

Closes #5257

elem.closest("[data-link-for]") matches the element itself, so when an <a> has data-link-for (for example from [=bar/foo=] syntax), the hint wrongly says the link is "inside" a scoped section when the attribute is on the link itself.

Uses parentElement.closest() to restrict the lookup to ancestors, and guards the empty-string case, since data-link-for="" means intentionally unscoped.

Written with AI: this change was generated by Claude. Per AI_POLICY.md.

@marcoscaceres marcoscaceres added the AI Contains AI-generated logic; see AI_POLICY.md label Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Contains AI-generated logic; see AI_POLICY.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: closest('[data-link-for]') in scoping hint can match the anchor itself

1 participant