Integrated: 8356276: JavaScript error in script.js after JDK-8348282

Hannes Wallnöfer hannesw at openjdk.org
Tue May 6 16:04:29 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.

This pull request has now been integrated.

Changeset: 9477c422
Author:    Hannes Wallnöfer <hannesw at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/9477c42215a219ef8d8f44f19506692f6efc82c0
Stats:     10 lines in 2 files changed: 7 ins; 1 del; 2 mod

8356276: JavaScript error in script.js after JDK-8348282

Reviewed-by: liach

-------------

PR: https://git.openjdk.org/jdk/pull/25069


More information about the javadoc-dev mailing list