Find better way to exclude empty HTML elements

XMLWordPrintable

    • Type: Task
    • Resolution: Fixed
    • Priority: P4
    • 19
    • Affects Version/s: None
    • Component/s: tools

      The `Content.isValid()` method is currently used to detect empty HtmlTree instances that should not be added in `HtmlTree.add(Content)`. This is not a great solution for a few reasons:

       - Content that is generated and added is silently dropped
       - The implementation of `isValid()` is quite specific for various HTML elements, making it hard to understand
       - Content also has an `isEmpty()` method which in the default implementation is sometimes but not always the logical negation of `isValid()`
       - There are times when we do want to add "invalid" content, for which there is the HtmlTree.EMPTY sentinel value (see JDK-8267394)

      We should try to find a solution to these problems that is simpler and is less prone to surprising behavior.

            Assignee:
            Hannes Wallnoefer
            Reporter:
            Hannes Wallnoefer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: