Skip to content

Commit

Permalink
8266856: Make <wbr> element void
Browse files Browse the repository at this point in the history
Reviewed-by: prappo, iris, vromero
  • Loading branch information
jonathan-gibbons committed May 21, 2021
1 parent 7a63ff7 commit e094f3f
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 3 deletions.
Expand Up @@ -392,7 +392,7 @@ public boolean accepts(HtmlTag t) {
}
},

WBR(BlockType.INLINE, EndKind.REQUIRED),
WBR(BlockType.INLINE, EndKind.NONE),

VAR(BlockType.INLINE, EndKind.REQUIRED);

Expand Down
@@ -0,0 +1,66 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/*
* @test
* @bug 8266856
* @modules jdk.javadoc/jdk.javadoc.internal.doclint
* jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.markup
* @run main TestVoidHtmlElements
*/

import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
import jdk.javadoc.internal.doclint.HtmlTag;

public class TestVoidHtmlElements {

public static void main(String[] args) {
int checks = 0;

// For tags that are represented as both an HtmlTag and a TagName,
// check that the definition of void-ness is the same.
for (HtmlTag htmlTag : HtmlTag.values()) {
try {
TagName tagName = TagName.valueOf(htmlTag.name());
checks++;
check(htmlTag, tagName);
} catch (IllegalArgumentException e) {
// no matching TagName
}
}

if (checks == 0) { // suspicious
throw new AssertionError();
}
System.out.println(checks + " checks passed");
}

private static void check(HtmlTag htmlTag, TagName tagName) {
boolean elementIsVoid = new HtmlTree(tagName).isVoid();
boolean elementHasNoEndTag = htmlTag.endKind == HtmlTag.EndKind.NONE;
if (elementIsVoid != elementHasNoEndTag) {
throw new AssertionError(htmlTag + ", " + elementIsVoid + ", " + elementHasNoEndTag);
}
}
}
@@ -1,6 +1,6 @@
/*
* @test /nodynamiccopyright/
* @bug 8072945 8247957
* @bug 8072945 8247957 8266856
* @summary test tags and attributes specific to the output HTML version
* @library ..
* @modules jdk.javadoc/jdk.javadoc.internal.doclint
Expand Down Expand Up @@ -151,7 +151,7 @@ public void notSupportedTags_html5() { }
* <div class="desc">Desc</div>
* </template>
* <p>Test current time is <time>10:00</time> at night</p>
* <p>Test <wbr>WBR</wbr> text</p>
* <p>Test<wbr>text</p>
*/
public void SupportedTags_html5() { }

Expand Down

1 comment on commit e094f3f

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.