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

Find better way to exclude empty HTML elements

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: P4 P4
    • 19
    • None
    • 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.

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

              Created:
              Updated:
              Resolved: