src/main/java/com/machinezoo/pushmode/dom/DomContainer.java
public DomContainer add(DomContent child) {
		touch();
		/*
		 * Null tolerance is very important. It avoids lots of null checks on application side.
		 * It also makes it easy to create application logic with optional result.
		 */
		if (child != null) {
			if (child instanceof DomElement) {
				/*
				 * Elements are the only kind of content node that can be always simply appended.
				 */
				reserveOne();
				children[size] = child;
				++size;
			} else if (child instanceof DomText) {
				/*
				 * Text nodes require merging if there is another text node before them.
				 * We also have to ignore text nodes with empty or null string.
				 * This ensures that all constructed elements and fragments can be serialized into valid HTML
				 * and node indexes in the HTML will correspond to node indexes in the element or fragment.
				 */
				DomText node = (DomText)child;
				if (!node.text().isEmpty()) {
					if (size > 0 && children[size - 1] instanceof DomText) {
						children[size - 1] = new DomText(((DomText)children[size - 1]).text() + node.text());
					} else {
						reserveOne();
						children[size] = child;
						++size;
					}
				}
			} else if (child instanceof DomFragment) {
				/*
				 * Fragments are inlined immediately. Allowing them in elements or other fragments
				 * would require later compacting/normalization step, which would be expensive and inconvenient.
				 */
				DomFragment fragment = (DomFragment)child;
				for (int i = 0; i < fragment.size; ++i)
					add(fragment.children[i]);
			} else {
				/*
				 * Nothing stops users from deriving their own class from DomContent.
				 * We don't want to deal with such cases, so let's just throw when someone tries to do it.
				 */
				throw new IllegalArgumentException();
			}
		}
		return this;
	}
/**
	 * Adds new child node to the list of children.
	 * Fragments will be inlined, {@code null}s ignored, and text concatenated.
	 * 
	 * @param child
	 *            node to add (ignored if {@code null})
	 * @return {@code this}
	 * @throws IllegalStateException
	 *             if this element or fragment is frozen
	 * @see #add(String)
	 * @see #add(Collection)
	 * @see #add(Stream)
	 */
Adds new child node to the list of children.
Fragments will be inlined,  nulls ignored, and text concatenated.


Adds new child node to the list of children . Fragments will be inlined nulls ignored and text concatenated .
public DomContainer add(DomContent child) {
		touch();
		/*
		 * Null tolerance is very important. It avoids lots of null checks on application side.
		 * It also makes it easy to create application logic with optional result.
		 */
		if (child != null) {
			if (child instanceof DomElement) {
				/*
				 * Elements are the only kind of content node that can be always simply appended.
				 */
				reserveOne();
				children[size] = child;
				++size;
			} else if (child instanceof DomText) {
				/*
				 * Text nodes require merging if there is another text node before them.
				 * We also have to ignore text nodes with empty or null string.
				 * This ensures that all constructed elements and fragments can be serialized into valid HTML
				 * and node indexes in the HTML will correspond to node indexes in the element or fragment.
				 */
				DomText node = (DomText)child;
				if (!node.text().isEmpty()) {
					if (size > 0 && children[size - 1] instanceof DomText) {
						children[size - 1] = new DomText(((DomText)children[size - 1]).text() + node.text());
					} else {
						reserveOne();
						children[size] = child;
						++size;
					}
				}
			} else if (child instanceof DomFragment) {
				/*
				 * Fragments are inlined immediately. Allowing them in elements or other fragments
				 * would require later compacting/normalization step, which would be expensive and inconvenient.
				 */
				DomFragment fragment = (DomFragment)child;
				for (int i = 0; i < fragment.size; ++i)
					add(fragment.children[i]);
			} else {
				/*
				 * Nothing stops users from deriving their own class from DomContent.
				 * We don't want to deal with such cases, so let's just throw when someone tries to do it.
				 */
				throw new IllegalArgumentException();
			}
		}
		return this;
	}
public DomContainer add ( DomContent child ) { touch ( ) ; /*
		 * Null tolerance is very important. It avoids lots of null checks on application side.
		 * It also makes it easy to create application logic with optional result.
		 */ if ( child != null ) { if ( child instanceof DomElement ) { /*
				 * Elements are the only kind of content node that can be always simply appended.
				 */ reserveOne ( ) ; children [ size ] = child ; ++ size ; } else if ( child instanceof DomText ) { /*
				 * Text nodes require merging if there is another text node before them.
				 * We also have to ignore text nodes with empty or null string.
				 * This ensures that all constructed elements and fragments can be serialized into valid HTML
				 * and node indexes in the HTML will correspond to node indexes in the element or fragment.
				 */ DomText node = ( DomText ) child ; if ( ! node . text ( ) . isEmpty ( ) ) { if ( size > 0 && children [ size - 1 ] instanceof DomText ) { children [ size - 1 ] = new DomText ( ( ( DomText ) children [ size - 1 ] ) . text ( ) + node . text ( ) ) ; } else { reserveOne ( ) ; children [ size ] = child ; ++ size ; } } } else if ( child instanceof DomFragment ) { /*
				 * Fragments are inlined immediately. Allowing them in elements or other fragments
				 * would require later compacting/normalization step, which would be expensive and inconvenient.
				 */ DomFragment fragment = ( DomFragment ) child ; for ( int i = 0 ; i < fragment . size ; ++ i ) add ( fragment . children [ i ] ) ; } else { /*
				 * Nothing stops users from deriving their own class from DomContent.
				 * We don't want to deal with such cases, so let's just throw when someone tries to do it.
				 */ throw new IllegalArgumentException ( ) ; } } return this ; }
Adds new child node to the list of children.
Adds new child node to the list of children .