RFR: JDK-8219946: Set class on body elements

Jonathan Gibbons jonathan.gibbons at oracle.com
Mon Mar 4 23:44:29 UTC 2019


Please review a fairly simple change to have javadoc set a `class` 
attribute on the `<body>` element on every generated page. Providing the 
value will make it possible/easier to override styles on different types 
of pages.

In terms of implementation, this is very similar to setting the 
`generator` in a `<meta>` element in the `<head>` element of a page, as 
done recently in JDK-8218998. However, while "generator" has more of a 
tracing/debugging feel to it, class names that are intended for use in a 
stylesheet deserve to be end-user-friendly, and (eventually) 
documented/specified.

Most names are generated automatically from the implementation class 
name, which catches most uses. The name generation is done in a new 
method, which allows it to be overridden if ever that becomes necessary. 
Some outlier uses don't use `HtmlDocWriter.getBody` and are fixed up 
locally. The frame-related sites will eventually be removed, when 
support for frames is removed; the remaining sites should be brought in 
line with the rest of the code, but that would be a separate RFE.

Some tests, which included `<body>` in their golden text needed to be 
updated in the obvious way. The primary new test leverages the 
recently-added TestMetadata.java class, which already generates all the 
requisite test files: the new `testBodyClasses()` method is a 
copy/edit/paste of the existing `testGenerator` feature.

-- Jon

JBS: https://bugs.openjdk.java.net/browse/JDK-8219946
Webrev: http://cr.openjdk.java.net/~jjg/8219946/webrev.00/




More information about the javadoc-dev mailing list