|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace dW\HTML5;
|
|
|
|
|
|
|
|
class Element extends \DOMElement {
|
|
|
|
use Ancestor, Descendant {
|
|
|
|
Ancestor::compare insteadof Descendant;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Used for template elements
|
|
|
|
public $content = null;
|
|
|
|
|
|
|
|
public function __construct(string $name, string $value = '', string $namespaceURI = '') {
|
|
|
|
parent::__construct($name, $value, $namespaceURI);
|
|
|
|
|
|
|
|
if ($name === 'template' && $namespaceURI === '') {
|
|
|
|
$this->content = $this->ownerDocument->createDocumentFragment();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isMathMLTextIntegrationPoint(): bool {
|
|
|
|
return (
|
|
|
|
$this->namespaceURI === Parser::MATHML_NAMESPACE && (
|
|
|
|
$this->nodeName === 'mi' || $this->nodeName === 'mo' || $this->nodeName === 'mn' || $this->nodeName === 'ms' || $this->nodeName === 'mtext'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isHTMLIntegrationPoint(): bool {
|
|
|
|
$encoding = strtolower($this->getAttribute('encoding'));
|
|
|
|
|
|
|
|
return ((
|
|
|
|
$this->namespaceURI === Parser::MATHML_NAMESPACE &&
|
|
|
|
$this->nodeName === 'annotation-xml' && (
|
|
|
|
$encoding === 'text/html' || $encoding === 'application/xhtml+xml'
|
|
|
|
)
|
|
|
|
) || (
|
|
|
|
$this->namespaceURI === Parser::SVG_NAMESPACE && (
|
|
|
|
$this->nodeName === 'foreignObject' || $this->nodeName === 'desc' || $this->nodeName === 'title'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|