1--TEST--
2HTMLDocument::createFromString() with namespaced attributes
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = DOM\HTMLDocument::createFromString(<<<HTML
9<!DOCTYPE html>
10<html>
11    <svg width="1" xmlns:xlink='http://www.w3.org/1999/xlink'>
12        <use xlink:href='#test' foo="bar"></use>
13    </svg>
14    <math>
15        <mo accent="true"></mo>
16    </math>
17</html>
18HTML);
19
20foreach (['svg', 'use', 'mo'] as $tag) {
21    $el = $dom->getElementsByTagName($tag)[0];
22    foreach ($el->attributes as $attribute) {
23        echo "Attribute: \n";
24        var_dump($attribute->name, $attribute->value, $attribute->namespaceURI);
25    }
26}
27
28?>
29--EXPECT--
30Attribute:
31string(5) "width"
32string(1) "1"
33NULL
34Attribute:
35string(11) "xmlns:xlink"
36string(28) "http://www.w3.org/1999/xlink"
37string(29) "http://www.w3.org/2000/xmlns/"
38Attribute:
39string(10) "xlink:href"
40string(5) "#test"
41string(28) "http://www.w3.org/1999/xlink"
42Attribute:
43string(3) "foo"
44string(3) "bar"
45NULL
46Attribute:
47string(6) "accent"
48string(4) "true"
49NULL
50