code: private void addEmptyElements() {
          for (Node node : nodes) {
              boolean empty = true;
              if(node instanceof NestableNode) {
  	            List<Node> nl = ((NestableNode) node).getChildren();
  	            for (Node n : nl) {
  	                if (n instanceof Element) {
  	                    empty = false;
  	                    break;
  	                } else if (n instanceof Text) {
  	                    // TODO: Should we trim the text and see if it's length 0?
  	                    String value = ((Text) n).getContent();
  	                    if (value.length() > 0) {
  	                        empty = false;
  	                        break;
  	                    }
  	                }
  	            }
              }            
              if (empty) {
                  result.add(node);
              }
          }
      }
docs: Add {@code :empty} elements.
  
  @see <a href="http://www.w3.org/TR/css3-selectors/#empty-pseudo"><code>:empty</code> pseudo-class</a>