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:
1 parent
b810605da4
commit
20c0f26b00
3 files changed
+7
-1
No files matched your search
@@ -1952,7 +1952,7 @@ instead, we check that it's not a "finger" cursor.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:target:not([data-nosnippet]) {
|
:target:not([data-nosnippet]):not(:empty) {
|
||||||
background-color: var(--target-background-color);
|
background-color: var(--target-background-color);
|
||||||
border-right: 3px solid var(--target-border-color);
|
border-right: 3px solid var(--target-border-color);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ pub struct Foo {
|
|||||||
|
|
||||||
impl Foo {
|
impl Foo {
|
||||||
/// Some documentation
|
/// Some documentation
|
||||||
|
/// <a id="empty-anchor"></a>
|
||||||
/// # A Heading
|
/// # A Heading
|
||||||
pub fn a_method(&self) {}
|
pub fn a_method(&self) {}
|
||||||
|
|
||||||
|
|||||||
@@ -33,3 +33,8 @@ call-function: ("check-style", {
|
|||||||
"background": "#fdffd3",
|
"background": "#fdffd3",
|
||||||
"border": "#ad7c37",
|
"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"})
|
||||||
Reference in new issue
Block a user