RFR: 8356276: JavaScript error in script.js after JDK-8348282
Chen Liang
liach at openjdk.org
Tue May 6 15:19:14 UTC 2025
On Tue, 6 May 2025 14:57:20 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:
> Please review a simple fix to avoid a JavaScript error in API docs when syntax highlighting is not enabled.
>
> The fix consists in replacing `(hljs)` with `(typeof hljs !== "undefined")` in the `if` statement as the former throws a `TypeError` if `hljs` is undefined. The `try-catch` wrapper around `hljs.highlightAll()` is just added to be on the safe side, and the change in `Head.java` is just cleanup to preserve the separateion of .css and .js files.
>
> Labeled `noreg-hard` as we do not have a way to test the script in browser. I manually tested the fix in multiple browsers.
The js part looks good. Is the Java code just trivial cleanup and doesn't affect correctness of this patch?
-------------
Marked as reviewed by liach (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/25069#pullrequestreview-2818673892
More information about the javadoc-dev
mailing list