Modern DOM library written in PHP for HTML documents
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
907 B

<?php
/**
* @license MIT
* Copyright 2017 Dustin Wilson, J. King, et al.
* See LICENSE and AUTHORS files for details
*/
declare(strict_types=1);
namespace MensBeam\HTML\DOM;
use MensBeam\HTML\DOM\InnerNode\Element as InnerElement,
MensBeam\HTML\DOM\InnerNode\Reflection;
class HTMLTemplateElement extends Element {
protected DocumentFragment $_content;
// Templates can contain content in both light and shadow, so its content
// fragment must be stored here instead of in PHP's main inner document tree.
protected function __get_content(): DocumentFragment {
return $this->_content;
}
protected function __construct(InnerElement $element) {
parent::__construct($element);
$this->_content = $this->ownerDocument->createDocumentFragment();
Reflection::setProtectedProperty($this->_content, 'host', \WeakReference::create($this));
}
}