There are 24 failing tests if the `isValid()` check is omitted in 
HtmlTree.add(Content). I started going after „invalid“ HtmlTree instances using 
stack traces to locate their origin, but gave up after 3 or 4 due to the 
reasons given earlier: there’s quite a few of them, and even if we find them 
all there’s no way to prevent them from popping up in the future.

My conclusion would be to close this PR/issue as „won’t fix“ and start working 
on finding a better solution. IMO that solution would still be implemented in 
Content/HtmlTree, but should have a name that better reflects its purpose, and 
would possibly be implemented using different means at a different level.

Hannes

> Am 02.06.2021 um 16:32 schrieb Jonathan Gibbons <jonathan.gibb...@oracle.com>:
> 
> 
> On 6/2/21 7:13 AM, Hannes Wallnöfer wrote:
>> 
>> I agree that our current `isValid` implementation does not feel right.
>> 
>> But there are many (dozens?) of places in the code that potentially generate 
>> empty elements. If we want to avoid these, shifting the responsability to 
>> the content producer will blow up the code a lot. I'm trying out different 
>> things to see if I can come up with a better solution.
> 
> Do we have any sense of how often the "isValid" check prevents an empty node 
> to be added to the tree?
> 
> 
> 
>> 
>> -------------
>> 
>> PR: https://git.openjdk.java.net/jdk/pull/4130

Reply via email to