By default, the parser does not support XML-style namespaces using the : prefix. To enable this, you must pass xmlNamespaces => true in the configuration array passed to the HTML5 constructor.
You can also use implicitNamespaces to define default prefixes so that elements are namespaced even without an explicit declaration in the source HTML.
use Masterminds\HTML5;
// Enable XML namespaces
$html = new HTML5(array(
"xmlNamespaces" => true
));
$dom = $html->loadHTML('<t:tag xmlns:t="http://www.example.com"/>');
echo $dom->documentElement->namespaceURI; // http://www.example.com
use Masterminds\HTML5;
// Use implicit namespaces to avoid needing declarations in the HTML
$html = new HTML5(array(
"implicitNamespaces"=>array(
"t"=>"http://www.example.com"
)
));
$dom = $html->loadHTML('<t:tag/>');
echo $dom->documentElement->namespaceURI; // http://www.example.com