On Tue, 15 Oct 2024 10:41:43 GMT, Hannes Wallnöfer <hann...@openjdk.org> wrote:

> Please review the removal of code in `DocCommentParser` that created an error 
> when encountering a spurious "@" character in an HTML attribute value after a 
> line break. 
> 
> The removed code (which was added in its current form in 2012) seemed to 
> assume that such a "@" character was part of a block tag and therefore an 
> indication of an unclosed attribute value. However, both line breaks and "@" 
> are valid characters in HTML attributes. Note that valid content for HTML 
> attributes in `DocCommentParser` is [text and entities as per 
> HTML5][html5-attributes] as well as JavaDoc inline tags, but not block tags.
> 
> [html5-attributes]: 
> https://html.spec.whatwg.org/multipage/syntax.html#syntax-attribute-value
> 
> The change adds two doctree tests, one to make sure HTML attributes with 
> mixed values (text, line breaks, entities, inline tags, "@") are parsed 
> correctly, and a second one to make sure actual unclosed attribute values are 
> still recognized as errors.

I'm surprised we've had no tests for that code you deleted. But deleting it 
solves the original reporter's issue.

Let's hope they don't start using constructs like `title="{@see`. On second 
thought, in that case, they can escape `@` with `@@`, provided their javadoc is 
reasonably modern. Consider adding a test for this.

Additionally, for sanity's sake, I checked that newlines are indeed fine if 
quoted:

  - https://html.spec.whatwg.org/#attribute-value-(double-quoted)-state
  - https://html.spec.whatwg.org/#attribute-value-(single-quoted)-state

-------------

PR Comment: https://git.openjdk.org/jdk/pull/21520#issuecomment-2435354076

Reply via email to