rustdoc: don't highlight empty elements when they are the URL target

An empty anchor like `<a id="foo"></a>` used as a jump target in docs got
the target border, which shows up as a stray orange bar.
This commit is contained in:
dualfroz committed 2026-09-29 12:01:33 +02:00
1 parent b810605da4
commit 20c0f26b00
3 files changed
+7 -1

No files matched your search

+1
View File
@@ -27,6 +27,7 @@ pub struct Foo {
impl Foo {
/// Some documentation
/// <a id="empty-anchor"></a>
/// # A Heading
pub fn a_method(&self) {}
+5
View File
@@ -33,3 +33,8 @@ call-function: ("check-style", {
"background": "#fdffd3",
"border": "#ad7c37",
})
// An empty anchor must not get the target border.
go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html#empty-anchor"
assert: "#empty-anchor:target"
assert-css: ("#empty-anchor", {"border-right-width": "0px"})