Skip to content

Commit 7318cdc

Browse files
psoujanyRealCLanger
authored andcommitted
8221871: javadoc should not set role=region on <section> elements
Reviewed-by: clanger Backport-of: 0abdc38
1 parent 93666ae commit 7318cdc

File tree

5 files changed

+55
-78
lines changed

5 files changed

+55
-78
lines changed

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -740,9 +740,7 @@ public static HtmlTree SCRIPT(String src) {
740740
* @return an HtmlTree object for the SECTION tag
741741
*/
742742
public static HtmlTree SECTION() {
743-
HtmlTree htmltree = new HtmlTree(HtmlTag.SECTION);
744-
htmltree.setRole(Role.REGION);
745-
return htmltree;
743+
return new HtmlTree(HtmlTag.SECTION);
746744
}
747745

748746
/**
@@ -752,9 +750,7 @@ public static HtmlTree SECTION() {
752750
* @return an HtmlTree object for the SECTION tag
753751
*/
754752
public static HtmlTree SECTION(Content body) {
755-
HtmlTree htmltree = new HtmlTree(HtmlTag.SECTION, nullCheck(body));
756-
htmltree.setRole(Role.REGION);
757-
return htmltree;
753+
return new HtmlTree(HtmlTag.SECTION, nullCheck(body));
758754
}
759755

760756
/**

test/langtools/jdk/javadoc/doclet/testHtmlTag/TestHtmlTag.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void test_other() {
107107

108108
checkOutput("pkg3/package-summary.html", true,
109109
"<div class=\"contentContainer\">\n"
110-
+ "<section role=\"region\"><a id=\"package.description\">\n"
110+
+ "<section><a id=\"package.description\">\n"
111111
+ "<!-- -->\n"
112112
+ "</a>\n"
113113
+ "<div class=\"block\"><p>This is the first line. Note the newlines before the &lt;p&gt; is relevant.</div>\n"

test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java

Lines changed: 49 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/*
2525
* @test
2626
* @bug 8072945 8081854 8141492 8148985 8150188 4649116 8173707 8151743 8169819 8183037 8182765 8196202
27-
* 8202624
27+
* 8202624 8221871
2828
* @summary Test the version of HTML generated by the javadoc tool.
2929
* @author bpatel
3030
* @library ../lib
@@ -142,25 +142,6 @@ void html5Output() {
142142
+ "<nav role=\"navigation\">\n"
143143
+ "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
144144

145-
// Test for package-frame page
146-
checkOutput("pkg/package-frame.html", true,
147-
"<!DOCTYPE HTML>",
148-
"<meta name=\"dc.created\"",
149-
"<main role=\"main\">\n"
150-
+ "<h1 class=\"bar\"><a href=\"package-summary.html\" target=\"classFrame\">pkg</a></h1>",
151-
"<section role=\"region\">\n"
152-
+ "<h2 title=\"Interfaces\">Interfaces</h2>",
153-
"<section role=\"region\">\n"
154-
+ "<h2 title=\"Classes\">Classes</h2>",
155-
"<section role=\"region\">\n"
156-
+ "<h2 title=\"Enums\">Enums</h2>",
157-
"<section role=\"region\">\n"
158-
+ "<h2 title=\"Exceptions\">Exceptions</h2>",
159-
"<section role=\"region\">\n"
160-
+ "<h2 title=\"Errors\">Errors</h2>",
161-
"<section role=\"region\">\n"
162-
+ "<h2 title=\"Annotation Types\">Annotation Types</h2>");
163-
164145
// Test for package-summary page
165146
checkOutput("pkg/package-summary.html", true,
166147
"<!DOCTYPE HTML>",
@@ -175,7 +156,7 @@ void html5Output() {
175156
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
176157
"<main role=\"main\">\n"
177158
+ "<div class=\"header\">",
178-
"<section role=\"region\"><a id=\"package.description\">\n"
159+
"<section><a id=\"package.description\">\n"
179160
+ "<!-- -->\n"
180161
+ "</a>\n"
181162
+ "<div class=\"block\">Test package.</div>",
@@ -204,13 +185,13 @@ void html5Output() {
204185
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
205186
"<main role=\"main\">\n"
206187
+ "<div class=\"header\">",
207-
"<section role=\"region\">\n"
188+
"<section>\n"
208189
+ "<h2 title=\"Class Hierarchy\">Class Hierarchy</h2>",
209-
"<section role=\"region\">\n"
190+
"<section>\n"
210191
+ "<h2 title=\"Interface Hierarchy\">Interface Hierarchy</h2>",
211-
"<section role=\"region\">\n"
192+
"<section>\n"
212193
+ "<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>",
213-
"<section role=\"region\">\n"
194+
"<section>\n"
214195
+ "<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>",
215196
"<footer role=\"contentinfo\">\n"
216197
+ "<nav role=\"navigation\">\n"
@@ -248,9 +229,9 @@ void html5Output() {
248229
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
249230
"<main role=\"main\">\n"
250231
+ "<div class=\"header\">",
251-
"<section role=\"region\">\n"
232+
"<section>\n"
252233
+ "<h2 title=\"Contents\">Contents</h2>\n",
253-
"<section role=\"region\">\n"
234+
"<section>\n"
254235
+ "<h2 title=\"pkg\">pkg.*</h2>\n",
255236
"<footer role=\"contentinfo\">\n"
256237
+ "<nav role=\"navigation\">\n"
@@ -287,7 +268,7 @@ void html5Output() {
287268
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
288269
"<main role=\"main\">\n"
289270
+ "<div class=\"header\">",
290-
"<section role=\"region\">\n"
271+
"<section>\n"
291272
+ "<h2 title=\"Package\">Package&nbsp;pkg</h2>\n",
292273
"<footer role=\"contentinfo\">\n"
293274
+ "<nav role=\"navigation\">\n"
@@ -307,13 +288,13 @@ void html5Output() {
307288
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
308289
"<main role=\"main\">\n"
309290
+ "<div class=\"header\">",
310-
"<section role=\"region\">\n"
291+
"<section>\n"
311292
+ "<h2 title=\"Class Hierarchy\">Class Hierarchy</h2>\n",
312-
"<section role=\"region\">\n"
293+
"<section>\n"
313294
+ "<h2 title=\"Interface Hierarchy\">Interface Hierarchy</h2>\n",
314-
"<section role=\"region\">\n"
295+
"<section>\n"
315296
+ "<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>\n",
316-
"<section role=\"region\">\n"
297+
"<section>\n"
317298
+ "<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>\n",
318299
"<footer role=\"contentinfo\">\n"
319300
+ "<nav role=\"navigation\">\n"
@@ -355,11 +336,11 @@ void html5Output() {
355336
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
356337
"<main role=\"main\">\n"
357338
+ "<div class=\"header\">",
358-
"<section role=\"region\">\n"
339+
"<section>\n"
359340
+ "<h2>Overview</h2>\n",
360-
"<section role=\"region\">\n"
341+
"<section>\n"
361342
+ "<h2>Package</h2>\n",
362-
"<section role=\"region\">\n"
343+
"<section>\n"
363344
+ "<h2>Class or Interface</h2>\n",
364345
"<footer role=\"contentinfo\">\n"
365346
+ "<nav role=\"navigation\">\n"
@@ -378,46 +359,46 @@ void html5Output() {
378359
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
379360
"<main role=\"main\">\n"
380361
+ "<div class=\"header\">",
381-
"<section role=\"region\">\n"
362+
"<section>\n"
382363
+ "<ul class=\"blockList\">\n"
383364
+ "<li class=\"blockList\"><a id=\"nested.class.summary\">\n"
384365
+ "<!-- -->\n"
385366
+ "</a>\n"
386367
+ "<h3>Nested Class Summary</h3>\n"
387-
+ "<table class=\"memberSummary\">",
388-
"<section role=\"region\">\n"
368+
+ "<table class=\"memberSummary\">\n",
369+
"<section>\n"
389370
+ "<ul class=\"blockList\">\n"
390371
+ "<li class=\"blockList\"><a id=\"field.summary\">\n"
391372
+ "<!-- -->\n"
392373
+ "</a>\n"
393374
+ "<h3>Field Summary</h3>\n"
394-
+ "<table class=\"memberSummary\">",
395-
"<section role=\"region\">\n"
375+
+ "<table class=\"memberSummary\">\n",
376+
"<section>\n"
396377
+ "<ul class=\"blockList\">\n"
397378
+ "<li class=\"blockList\"><a id=\"constructor.summary\">\n"
398379
+ "<!-- -->\n"
399380
+ "</a>\n"
400381
+ "<h3>Constructor Summary</h3>\n"
401-
+ "<table class=\"memberSummary\">",
402-
"<section role=\"region\">\n"
382+
+ "<table class=\"memberSummary\">\n",
383+
"<section>\n"
403384
+ "<ul class=\"blockList\">\n"
404385
+ "<li class=\"blockList\"><a id=\"method.summary\">\n"
405386
+ "<!-- -->\n"
406387
+ "</a>\n"
407388
+ "<h3>Method Summary</h3>",
408-
"<section role=\"region\">\n"
389+
"<section>\n"
409390
+ "<ul class=\"blockList\">\n"
410391
+ "<li class=\"blockList\"><a id=\"field.detail\">\n"
411392
+ "<!-- -->\n"
412393
+ "</a>\n"
413394
+ "<h3>Field Detail</h3>",
414-
"<section role=\"region\">\n"
395+
"<section>\n"
415396
+ "<ul class=\"blockList\">\n"
416397
+ "<li class=\"blockList\"><a id=\"constructor.detail\">\n"
417398
+ "<!-- -->\n"
418399
+ "</a>\n"
419400
+ "<h3>Constructor Detail</h3>",
420-
"<section role=\"region\">\n"
401+
"<section>\n"
421402
+ "<ul class=\"blockList\">\n"
422403
+ "<li class=\"blockList\"><a id=\"method.detail\">\n"
423404
+ "<!-- -->\n"
@@ -440,27 +421,27 @@ void html5Output() {
440421
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
441422
"<main role=\"main\">\n"
442423
+ "<div class=\"header\">",
443-
"<section role=\"region\">\n"
424+
"<section>\n"
444425
+ "<ul class=\"blockList\">\n"
445426
+ "<li class=\"blockList\"><a id=\"enum.constant.summary\">\n"
446427
+ "<!-- -->\n"
447428
+ "</a>\n"
448429
+ "<h3>Enum Constant Summary</h3>\n"
449-
+ "<table class=\"memberSummary\">",
450-
"<section role=\"region\">\n"
430+
+ "<table class=\"memberSummary\">\n",
431+
"<section>\n"
451432
+ "<ul class=\"blockList\">\n"
452433
+ "<li class=\"blockList\"><a id=\"method.summary\">\n"
453434
+ "<!-- -->\n"
454435
+ "</a>\n"
455436
+ "<h3>Method Summary</h3>\n"
456-
+ "<table class=\"memberSummary\">",
457-
"<section role=\"region\">\n"
437+
+ "<table class=\"memberSummary\">\n",
438+
"<section>\n"
458439
+ "<ul class=\"blockList\">\n"
459440
+ "<li class=\"blockList\"><a id=\"enum.constant.detail\">\n"
460441
+ "<!-- -->\n"
461442
+ "</a>\n"
462443
+ "<h3>Enum Constant Detail</h3>",
463-
"<section role=\"region\">\n"
444+
"<section>\n"
464445
+ "<ul class=\"blockList\">\n"
465446
+ "<li class=\"blockList\"><a id=\"method.detail\">\n"
466447
+ "<!-- -->\n"
@@ -483,14 +464,14 @@ void html5Output() {
483464
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
484465
"<main role=\"main\">\n"
485466
+ "<div class=\"header\">",
486-
"<section role=\"region\">\n"
467+
"<section>\n"
487468
+ "<ul class=\"blockList\">\n"
488469
+ "<li class=\"blockList\"><a id=\"method.summary\">\n"
489470
+ "<!-- -->\n"
490471
+ "</a>\n"
491472
+ "<h3>Method Summary</h3>\n"
492-
+ "<table class=\"memberSummary\">",
493-
"<section role=\"region\">\n"
473+
+ "<table class=\"memberSummary\">\n",
474+
"<section>\n"
494475
+ "<ul class=\"blockList\">\n"
495476
+ "<li class=\"blockList\"><a id=\"method.detail\">\n"
496477
+ "<!-- -->\n"
@@ -513,13 +494,13 @@ void html5Output() {
513494
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
514495
"<main role=\"main\">\n"
515496
+ "<div class=\"header\">",
516-
"<section role=\"region\">\n"
497+
"<section>\n"
517498
+ "<ul class=\"blockList\">\n"
518499
+ "<li class=\"blockList\"><a id=\"constructor.summary\">\n"
519500
+ "<!-- -->\n"
520501
+ "</a>\n"
521502
+ "<h3>Constructor Summary</h3>",
522-
"<section role=\"region\">\n"
503+
"<section>\n"
523504
+ "<ul class=\"blockList\">\n"
524505
+ "<li class=\"blockList\"><a id=\"constructor.detail\">\n"
525506
+ "<!-- -->\n"
@@ -542,13 +523,13 @@ void html5Output() {
542523
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
543524
"<main role=\"main\">\n"
544525
+ "<div class=\"header\">",
545-
"<section role=\"region\">\n"
526+
"<section>\n"
546527
+ "<ul class=\"blockList\">\n"
547528
+ "<li class=\"blockList\"><a id=\"constructor.summary\">\n"
548529
+ "<!-- -->\n"
549530
+ "</a>\n"
550531
+ "<h3>Constructor Summary</h3>",
551-
"<section role=\"region\">\n"
532+
"<section>\n"
552533
+ "<ul class=\"blockList\">\n"
553534
+ "<li class=\"blockList\"><a id=\"constructor.detail\">\n"
554535
+ "<!-- -->\n"
@@ -571,21 +552,21 @@ void html5Output() {
571552
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
572553
"<main role=\"main\">\n"
573554
+ "<div class=\"header\">",
574-
"<section role=\"region\">\n"
555+
"<section>\n"
575556
+ "<ul class=\"blockList\">\n"
576557
+ "<li class=\"blockList\"><a id=\"annotation.type.required.element.summary\">\n"
577558
+ "<!-- -->\n"
578559
+ "</a>\n"
579560
+ "<h3>Required Element Summary</h3>\n"
580-
+ "<table class=\"memberSummary\">",
581-
"<section role=\"region\">\n"
561+
+ "<table class=\"memberSummary\">\n",
562+
"<section>\n"
582563
+ "<ul class=\"blockList\">\n"
583564
+ "<li class=\"blockList\"><a id=\"annotation.type.optional.element.summary\">\n"
584565
+ "<!-- -->\n"
585566
+ "</a>\n"
586567
+ "<h3>Optional Element Summary</h3>\n"
587-
+ "<table class=\"memberSummary\">",
588-
"<section role=\"region\">\n"
568+
+ "<table class=\"memberSummary\">\n",
569+
"<section>\n"
589570
+ "<ul class=\"blockList\">\n"
590571
+ "<li class=\"blockList\"><a id=\"annotation.type.element.detail\">\n"
591572
+ "<!-- -->\n"
@@ -608,8 +589,8 @@ void html5Output() {
608589
+ "<!-- ========= START OF TOP NAVBAR ======= -->",
609590
"<main role=\"main\">\n"
610591
+ "<div class=\"header\">",
611-
"<table class=\"useSummary\">",
612-
"<section role=\"region\"><a id=\"pkg\">\n"
592+
"<table class=\"useSummary\">\n",
593+
"<section><a id=\"pkg\">\n"
613594
+ "<!-- -->\n"
614595
+ "</a>\n"
615596
+ "<h3>Uses of <a href=\"../RegClass.html\" title=\"class in pkg1\">RegClass</a> in <a href=\"../../pkg/package-summary.html\">pkg</a></h3>\n"
@@ -690,7 +671,7 @@ void html5NegatedOutput() {
690671
"<a name=\"navbar.top.firstrow\">\n"
691672
+ "<!-- -->\n"
692673
+ "</a>",
693-
"<section role=\"region\">\n"
674+
"<section>\n"
694675
+ "<h2 title=\"Package pkg Description\">Package pkg Description</h2>\n",
695676
"<table class=\"typeSummary\" summary=\"Interface Summary table, listing interfaces, and an explanation\">",
696677
"<table class=\"typeSummary\" summary=\"Class Summary table, listing classes, and an explanation\">",
@@ -1050,12 +1031,12 @@ void html5NegatedOutput() {
10501031
+ "//-->\n"
10511032
+ "</script>\n"
10521033
+ "<div class=\"header\">",
1053-
"<table class=\"useSummary\" summary=\"Use table, listing packages, and an explanation\">",
1034+
"<div class=\"useSummary\">",
10541035
"<li class=\"blockList\"><a name=\"pkg\">\n"
10551036
+ "<!-- -->\n"
10561037
+ "</a>\n"
10571038
+ "<h3>Uses of <a href=\"../RegClass.html\" title=\"class in pkg1\">RegClass</a> in <a href=\"../../pkg/package-summary.html\">pkg</a></h3>\n"
1058-
+ "<table class=\"useSummary\" summary=\"Use table, listing fields, and an explanation\">");
1039+
+ "<table class=\"useSummary\">");
10591040

10601041
// Negated test for main index page
10611042
checkOutput("index.html", false,

test/langtools/jdk/javadoc/doclet/testModules/TestModules.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ void checkNoDescription(boolean found) {
736736

737737
void checkHtml5Description(boolean found) {
738738
checkOutput("moduleA/module-summary.html", found,
739-
"<section role=\"region\">\n"
739+
"<section>\n"
740740
+ "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
741741
+ " This API element is subject to removal in a future version.</span>\n"
742742
+ "<div class=\"deprecationComment\">This module is deprecated.</div>\n"
@@ -748,7 +748,7 @@ void checkHtml5Description(boolean found) {
748748
+ "<div class=\"block\">This is a test description for the moduleA module with a Search "
749749
+ "phrase <a id=\"searchphrase\" class=\"searchTagResult\">search phrase</a>.</div>");
750750
checkOutput("moduleB/module-summary.html", found,
751-
"<section role=\"region\">\n"
751+
"<section>\n"
752752
+ "<!-- ============ MODULE DESCRIPTION =========== -->\n"
753753
+ "<a id=\"module.description\">\n"
754754
+ "<!-- -->\n"

test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void test2() {
194194
);
195195
checkOutput("class-use/UsedInC.html", true,
196196
"<li class=\"blockList\">\n"
197-
+ "<section role=\"region\"><a id=\"unnamed.package\">"
197+
+ "<section><a id=\"unnamed.package\">"
198198
);
199199
checkOutput("package-use.html", true,
200200
"<th class=\"colFirst\" scope=\"row\">"

0 commit comments

Comments
 (0)