RemexHtml/TreeBuilder/TreeBuilder.php
public function checkUnclosed( $allowed, $pos ) {
		if ( $this->ignoreErrors ) {
			return;
		}

		$stack = $this->stack;
		$unclosedErrors = [];
		for ( $i = $stack->length() - 1; $i >= 0; $i-- ) {
			$unclosedName = $stack->item( $i )->htmlName;
			if ( !isset( $allowed[$unclosedName] ) ) {
				$unclosedErrors[$unclosedName] = true;
			}
		}
		if ( $unclosedErrors ) {
			$names = implode( ', ', array_keys( $unclosedErrors ) );
			$this->error( "closing unclosed $names", $pos );
		}
	}
public function checkUnclosed( $allowed, $pos ) {
		if ( $this->ignoreErrors ) {
			return;
		}

		$stack = $this->stack;
		$unclosedErrors = [];
		for ( $i = $stack->length() - 1; $i >= 0; $i-- ) {
			$unclosedName = $stack->item( $i )->htmlName;
			if ( !isset( $allowed[$unclosedName] ) ) {
				$unclosedErrors[$unclosedName] = true;
			}
		}
		if ( $unclosedErrors ) {
			$names = implode( ', ', array_keys( $unclosedErrors ) );
			$this->error( "closing unclosed $names", $pos );
		}
	}
public function checkUnclosed ( $ allowed , $ pos ) { if ( $ this -> ignoreErrors ) { return ; } $ stack = $ this -> stack ; $ unclosedErrors = [ ] ; for ( $ i = $ stack -> length ( ) - 1 ; $ i >= 0 ; $ i -- ) { $ unclosedName = $ stack -> item ( $ i ) -> htmlName ; if ( ! isset ( $ allowed [ $ unclosedName ] ) ) { $ unclosedErrors [ $ unclosedName ] = true ; } } if ( $ unclosedErrors ) { $ names = implode ( ', ' , array_keys ( $ unclosedErrors ) ) ; $ this -> error ( "closing unclosed $names" , $ pos ) ; } }
Check the stack to see if there is any element which is not on the list
of allowed elements. Raise an error if any are found.

@param array $allowed An array with the HTML element names in the key
@param int $pos
Check the stack to see if there is any element which is not on the list of allowed elements . Raise an error if any are found .