public function __construct($isFragment = false, array
$options = array
()) { $this->options =
$options;
if (isset($options[self::OPT_TARGET_DOC
])) { $this->doc =
$options[self::OPT_TARGET_DOC
];
} else { $impl =
new \
DOMImplementation();
// XXX:
// Create the doctype. For now, we are always creating HTML5
// documents, and attempting to up-convert any older DTDs to HTML5.
$dt =
$impl->
createDocumentType('html'
);
// $this->doc = \DOMImplementation::createDocument(NULL, 'html', $dt);
$this->doc =
$impl->
createDocument(null, '',
$dt);
$this->doc->encoding = !
empty($options['encoding'
]) ?
$options['encoding'
] : 'UTF-8';
} $this->errors = array
();
$this->current =
$this->doc; // ->documentElement;
// Create a rules engine for tags.
$this->rules =
new TreeBuildingRules();