Thanks;  yes, I agree I don't expect to use this in the near future, but I see it as part of the trend towards a better specified, more understandable, more configurable stylesheet.

-- Jon

On 3/5/19 7:45 AM, Hannes Wallnöfer wrote:
I think it’s a good idea to do this. I’m not sure we’ll need to target specific 
classes of pages in the style sheet, but if we do then it’s much cleaner to use 
actual page types as class attributes than some random other page properties.

+1

Hannes


Am 05.03.2019 um 00:44 schrieb Jonathan Gibbons <[email protected]>:

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/


Reply via email to