-
Notifications
You must be signed in to change notification settings - Fork 2.1k
doxygen: CSS hack to hide doc breaks on older browsers #21312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
tbh, i wouldn't even consider this an issue as |
I'm not sure if it makes sense to make a hack even hackier for browsers that nobody should use anymore. The issue will be pretty much solved by #21300 anyways. It would be possible to hack it with JavaScript. This is what a friendly AI language model suggested. In the @supports selector(:has(*)) {
li:has(> .item a[class^="md_"][class$="doc.html"]),
tr:has(> .entry a[href^="md_"][href$="doc.html"]) {
display: none;
}
}
@supports not selector(:has(*)) {
/* :has() is not supported */
body::after {
content: "fallback";
display: none;
}
} In the <head>
...head stuff...
<script>
document.addEventListener("DOMContentLoaded", function () {
if (getComputedStyle(document.body, "::after").content.includes("fallback")) {
document.querySelectorAll("li .item a[class^='md_'][class$='doc.html']").forEach(a => {
a.closest("li").style.display = "none";
});
document.querySelectorAll("tr .entry a[href^='md_'][href$='doc.html']").forEach(a => {
a.closest("tr").style.display = "none";
});
}
});
</script>
...more head stuff
</head> But having a hack for old and new browsers each would be kind of pointless and it would be possible to just use JS in all cases: <head>
...head stuff...
<script>
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll("li .item a[class^='md_'][class$='doc.html']").forEach(a => {
a.closest("li").style.display = "none";
});
document.querySelectorAll("tr .entry a[href^='md_'][href$='doc.html']").forEach(a => {
a.closest("tr").style.display = "none";
});
});
</script>
...more head stuff...
</head> This is untested. |
Instead of hiding the elements, JS could totally remove them entirely as well: <script>
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll("li .item a[class^='md_'][class$='doc.html']").forEach(a => {
a.closest("li")?.remove();
});
document.querySelectorAll("tr .entry a[href^='md_'][href$='doc.html']").forEach(a => {
a.closest("tr")?.remove();
});
});
</script> |
Description
The fix proposed in #21273 does not work on older browsers such as Firefox 116 since it uses the relatively new
:has
CSS selector: https://caniuse.com/css-hasNot sure if there is a good replacement for it, maybe using less?
The text was updated successfully, but these errors were encountered: