diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index df7b6e9b99a..b64fe74e960 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -578,11 +578,13 @@ ul.block, .block li { .src-line-numbers a { color: var(--src-line-numbers-span-color); } -.src-line-numbers .line-highlighted { - background-color: var(--src-line-number-highlighted-background-color); -} .src-line-numbers :target { background-color: transparent; + border-right: none; + padding-right: 0; +} +.src-line-numbers .line-highlighted { + background-color: var(--src-line-number-highlighted-background-color); } .search-loading { diff --git a/src/test/rustdoc-gui/source-code-page.goml b/src/test/rustdoc-gui/source-code-page.goml index 31d55cd7885..c71a3d64d0c 100644 --- a/src/test/rustdoc-gui/source-code-page.goml +++ b/src/test/rustdoc-gui/source-code-page.goml @@ -6,6 +6,11 @@ click: ".src-line-numbers > a:nth-child(4)" // This is the anchor for line 4. // Ensure that the page URL was updated. assert-document-property: ({"URL": "lib.rs.html#4"}, ENDS_WITH) assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"}) +// Ensure that the default style, with the right border, isn't used. +assert-css: ("//*[@id='4']", {"border-right-width": "0px"}) +reload: +assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"}) +assert-css: ("//*[@id='4']", {"border-right-width": "0px"}) // We now check that the good anchors are highlighted goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#4-6" assert-attribute-false: (".src-line-numbers > a:nth-child(3)", {"class": "line-highlighted"})