On Tue, 19 Oct 2021 16:14:37 GMT, Pavel Rappo <pra...@openjdk.org> wrote:
>> Please review a change to add a copy-to-clipboard feature to snippets. I >> took special care to make the feature usable on mobile devices. Sample >> output can be viewed and tested here: >> >> http://cr.openjdk.java.net/~hannesw/8275406/api.00/java.base/java/lang/Throwable.html#printStackTrace() > > test/langtools/jdk/javadoc/doclet/testSnippetTag/TestSnippetTag.java line 214: > >> 212: <span class="element-name">case%s</span>()</div> >> 213: <div class="block"> >> 214: <div class="snippet-container"><a href="#" >> class="snippet-copy" onclick="cop\ > > I'm sorry for hard-coding the snippet HTML output; I should've encapsulated > it instead. Now every change to the HTML structure ripples through the tests. > I'll work on improving that, I promise. > > Separately. Aren't these "Copy" and "Copied!" strings localized? What happens > if this test is run on some other locale? Yes, they are localized. Good question, I do believe tests are run with fixed en/US locale, but I'm not absolutely sure. > test/langtools/jdk/javadoc/lib/javadoc/tester/LinkChecker.java line 354: > >> 352: void addReference(String name, Path from, int line) { >> 353: if (checked) { >> 354: if (name != null && !name.isEmpty()) { > > I wonder if we should make this check more specific so as to allow only the > snippet copy-to-clipboard link. I think this should be ok for the general case. Linking to "#" (i.e. empty fragment) is common practice for links that trigger script functions. ------------- PR: https://git.openjdk.java.net/jdk/pull/6011