Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8292157

Incorrect error: "block element not allowed within inline element <a>"

XMLWordPrintable

    • b26
    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      For example when a p tag is nested within an a tag, Javadoc incorrectly gives this error.
      The content model of the a tag is "transparent" (with some specific restrictions, see [1]).
      I don't know whether Javadoc fully implements all the content models [2] and their rules, but it should err on the side of caution and not give errors on valid HTML5 content.

      [1] https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element
      [2] https://html.spec.whatwg.org/multipage/dom.html#content-models

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create `Foo.java` as below and run `javadoc Foo.java`.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No errors
      ACTUAL -
      Foo.java:5: error: block element not allowed within inline element <a>: p
          <p>A whole paragraph
          ^

      ---------- BEGIN SOURCE ----------
      /**
      Sentence.

      <a href="https://foo.bar">
          <p>A whole paragraph
          that is clickable.</p>
      </a>
       */
      public class Foo {}

      ---------- END SOURCE ----------

            hannesw Hannes Wallnoefer
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: