Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/link-to-dfn.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ function showLinkingError(elems) {
// Check if the link is inside a data-link-for section — a common footgun
// where [=global-term=] gets scoped to the interface and fails.
const scopedSection = /** @type {HTMLElement | null} */ (
elem.closest("[data-link-for]")
elem.parentElement?.closest("[data-link-for]")
Comment thread
marcoscaceres marked this conversation as resolved.
Outdated
);
const scopingNote = scopedSection
const scopingNote = scopedSection?.dataset.linkFor
? ` This link is inside a \`data-link-for="${scopedSection.dataset.linkFor}"\` section — \`[=term=]\` links are scoped to that context. To link to a global concept instead, either add \`data-link-for=""\` on this \`<a>\` or move it outside the scoped section.`
: "";
Comment thread
marcoscaceres marked this conversation as resolved.
const hint = `Add a matching \`<dfn>\` element, ${docLink`use ${"[data-cite]"} to link to an external definition, or enable ${"[xref]"} for automatic cross-spec linking.`}${scopingNote}`;
Expand Down
Loading