Check an element for mf2 h-* class, typically to determine if backcompat should be used
@param DOMElement $el
427268
public function hasRootMf2(\DOMElement $el) {
		$class = str_replace(array("\t", "\n"), ' ', $el->getAttribute('class'));
		$classes = array_filter(explode(' ', $class));

		foreach ( $classes as $classname ) {
			if ( strpos($classname, 'h-') === 0 ) {
				return true;
			}
		}

		return false;
	}
1035997
protected function validateElement(BaseElement $element) : void
    {
        if ($element instanceof Break_) {
            $this->validateBreak($element);
        } elseif ($element instanceof Phoneme) {
            $this->validatePhoneme($element);
        } elseif ($element instanceof SayAs) {
            $this->validateSayAs($element);
        } elseif ($element instanceof Word) {
            $this->validateWord($element);
        }
    }
632221
public function assertMatchesSelector($selector, DOMElement $element, $message = '')
    {
        return PHPUnit_Framework_Assert::assertThat($element, $this->matchesSelector($selector), $message);
    }
1144162
public function withAppended(Element $el): self
    {
        $obj = clone $this;
        array_push($obj->_elements, $el);
        return $obj;
    }
1017898
protected function elementStylesToAttribute( DOMElement $element )
    {
        $styleString = $element->getAttribute( 'style' );
        if ( $styleString )
        {
            $styleArray = explode( ';', $styleString );
            foreach( $styleArray as $style )
            {
                if ( !$style )
                    continue;

                list( $name, $value ) = explode( ':', $style );
                $name  = strtolower( trim( $name ) );
                $value = trim( $value );

                if ( $name === 'float' || $name === 'text-align' )
                    $name = 'align';

                if ( $name )
                {
                    try
                    {
                        $element->setAttribute( $name, $value );
                    }
                    catch (DOMException $e)
                    {
                        $this->handleError( self::ERROR_DATA, $e->getMessage() );
                    }
                }
            }
        }
    }
558950
protected function elementIsBlock(DOMElement $element)
	{
		$style = $this->getStyle($element);
		if (preg_match('(\\bdisplay\\s*:\\s*block)i', $style))
		{
			return true;
		}
		if (preg_match('(\\bdisplay\\s*:\\s*(?:inli|no)ne)i', $style))
		{
			return false;
		}

		return ElementInspector::isBlock($element);
	}
961334
function addStopFieldsetElements($element)
    {
        if (is_array($element)) {
            $this->_stopFieldsetElements = array_merge($this->_stopFieldsetElements,
                                                       $element);
        } else {
            $this->_stopFieldsetElements[] = $element;
        }
    }
1310000
protected function appendHTML(DOMElement $elem, string $html): DOMElement
   {
       try {
           $dom = new DOMDocument();
           $this->loadHTML($dom, $html);
           foreach($dom->childNodes as $node) {
               if ($node instanceof DOMElement) {
                   $elem->appendChild($this->template->createTextNode("\n"));
                   $elem->appendChild($this->template->importNode($node, true));
               }
           }
           return $elem;
       } catch (Throwable $e) {
           throw new RuntimeException("Can't append HTML: " . $e->getMessage());
       }
   }
600354
public static function fromEncryptedKeyElement(DOMElement $element)
    {
        $objenc = new XMLSecEnc();
        $objenc->setNode($element);
        if (!$objKey = $objenc->locateKey()) {
            throw new Exception("Unable to locate algorithm for this Encrypted Key");
        }
        $objKey->isEncrypted = true;
        $objKey->encryptedCtx = $objenc;
        XMLSecEnc::staticLocateKeyInfo($objKey, $element);
        return $objKey;
    }
569735
public function formElement(IElement $element)
    {
        if ($element instanceof Textarea) {
            return $this->formTextarea($element);
        } elseif ($element instanceof Select) {
            return $this->formSelect($element);
        } elseif ($element instanceof Submit) {
            return $this->formInput($element);
        } elseif ($element instanceof Button) {
            // todo: is it right?
            throw new InvalidArgumentException("Button element should be rendered without Helper.");
        } else {
            return $this->formInput($element);
        }
    }
1148855
public function isLocalElement($element) {
        $uri = $element->namespaceURI;
        if (empty($uri)) {
            return false;
        }

        return isset(static::$local_ns[$uri]);
    }
867836
public function addMfClasses(DOMElement $el, $classes) {
		$existingClasses = str_replace(array("\t", "\n"), ' ', $el->getAttribute('class'));
		$existingClasses = array_filter(explode(' ', $existingClasses));

		$addClasses = array_diff(explode(' ', $classes), $existingClasses);

		if ( $addClasses ) {
			$el->setAttribute('class', $el->getAttribute('class') . ' ' . implode(' ', $addClasses));
		}
	}
859787
protected function unmarshall(DOMElement $element)
    {
        if (($identifier = $this->getDOMElementAttributeAs($element, 'identifier')) !== null) {

            $object = new SectionPart($identifier);

            if (($required = $this->getDOMElementAttributeAs($element, 'required', 'boolean')) !== null) {
                $object->setRequired($required);
            }

            if (($fixed = $this->getDOMElementAttributeAs($element, 'fixed', 'boolean')) !== null) {
                $object->setFixed($fixed);
            }

            $preConditionElts = $this->getChildElementsByTagName($element, 'preCondition');
            if (count($preConditionElts) > 0) {
                $preConditions = new PreConditionCollection();
                for ($i = 0; $i < count($preConditionElts); $i++) {
                    $marshaller = $this->getMarshallerFactory()->createMarshaller($preConditionElts[$i]);
                    $preConditions[] = $marshaller->unmarshall($preConditionElts[$i]);
                }
                $object->setPreConditions($preConditions);
            }

            $branchRuleElts = $this->getChildElementsByTagName($element, 'branchRule');
            if (count($branchRuleElts) > 0) {
                $branchRules = new BranchRuleCollection();
                for ($i = 0; $i < count($branchRuleElts); $i++) {
                    $marshaller = $this->getMarshallerFactory()->createMarshaller($branchRuleElts[$i]);
                    $branchRules[] = $marshaller->unmarshall($branchRuleElts[$i]);
                }
                $object->setBranchRules($branchRules);
            }

            $itemSessionControlElts = $this->getChildElementsByTagName($element, 'itemSessionControl');
            if (count($itemSessionControlElts) == 1) {
                $marshaller = $this->getMarshallerFactory()->createMarshaller($itemSessionControlElts[0]);
                $object->setItemSessionControl($marshaller->unmarshall($itemSessionControlElts[0]));
            }

            $timeLimitsElts = $this->getChildElementsByTagName($element, 'timeLimits');
            if (count($timeLimitsElts) == 1) {
                $marshaller = $this->getMarshallerFactory()->createMarshaller($timeLimitsElts[0]);
                $object->setTimeLimits($marshaller->unmarshall($timeLimitsElts[0]));
            }

            return $object;
        } else {
            $msg = "The mandatory attribute 'identifier' is missing from element '" . $element->localName . "'.";
            throw new UnmarshallingException($msg, $element);
        }
    }
1352687
protected function removeOverNested( Node $el ) {
        if( $el->isTextNode() )
            return;
        else if( $el->beyondDefinitionLimit() )
        {
            $el->getParent()->removeChild( $el );
        }
        else
        {
            foreach( $el->getChildren() as $child )
                $this->removeOverNested($child);
        }
    }
10410
protected function getInvalidFieldsetElements(ElementInterface $element, FieldsetInterface $fieldset)
    {
        $elementName = $this->normalizeElementName($element->getName());
        $elements = $fieldset->getElements();

        if (isset($elements[$elementName]) && $elements[$elementName] === $element) {
            if ($fieldset->getMessages()) {
                return $elements;
            }

            /* @var $fieldsetElement ElementInterface */
            foreach ($elements as $fieldsetElement) {
                if ($fieldsetElement->getMessages()
                    && ($fieldsetElement->getAttribute('type') === 'hidden'
                        || $fieldsetElement instanceof Element\Captcha)
                ) {
                    return $elements;
                }
            }
        }

        foreach ($fieldset->getFieldsets() as $fieldsetElement) {
            if ($elements = $this->getInvalidFieldsetElements($element, $fieldsetElement)) {
                return $elements;
            }
        }

        return [];
    }
889951
protected function addClass(\DOMElement $element, $class)
    {
        if ($element->hasAttribute('class')) {
            $element->setAttribute('class', $element->getAttribute('class') . ' ' . $class);
        } else {
            $element->setAttribute('class', $class);
        }
    }
1244321
protected function parseId(DOMElement $element, $flagRequired = true)
    {
        if ($flagRequired || (!$flagRequired && $element->hasAttribute('id'))) {
            $id = XmlUtil::getRequiredAttributeValue($element, 'id');

            $this->setId($id);
        }
    }