Closed
Description
Description
All attributes are being lowercased, but for svg elements they should have correct casing (e.g. viewbox should be viewBox).
\Dom\HTMLDocument::createFromString( '<html><body><svg VIEWBOX="1 2 3 4"></svg></html>' )->saveHTML()
// <html><head></head><body><svg viewbox="1 2 3 4"></svg></body></html>
\Dom\HTMLDocument::createFromString( '<html><body><svg VIEWBOX="1 2 3 4"><feSpotLight x="10" y="10" z="50" pointsAtX="100" pointsAtY="100" limitingConeAngle="
10" /></svg></html>' )->saveHTML();
// <html><head></head><body><svg viewbox="1 2 3 4"><fespotlight x="10" y="10" z="50" pointsatx="100" pointsaty="100" limitingconeangle="10"></fespotlight></svg></body></html>
\Dom\HTMLDocument::createFromString( '<html><body><svg VIEWBOX="1 2 3 4"></svg></html>' )->querySelector('svg')->attributes[0]->name;
// viewbox
Browser repro:
dom = (new DOMParser).parseFromString('<html><body><svg VIEWBOX="1 2 3 4"></svg></html>','text/html')
dom.documentElement.outerHTML
// <html><head></head><body><svg viewBox="1 2 3 4"></svg></body></html>
dom = (new DOMParser).parseFromString('<html><head></head><body><svg viewbox="1 2 3 4"><fespotlight x="10" y="10" z="50" pointsatx="100" pointsaty="100" limitingconeangle="10"></fespotlight></svg></body></html>','text/html')
dom.documentElement.outerHTML
// <html><head></head><body><svg viewBox="1 2 3 4"><feSpotLight x="10" y="10" z="50" pointsAtX="100" pointsAtY="100" limitingConeAngle="10"></feSpotLight></svg></body></html>
Ref: https://html.spec.whatwg.org/multipage/parsing.html#creating-and-inserting-nodes (there is a table of attributes if you scroll a bit, there's another table for tag names as well).
Lexbor does have this attribute mapping in the code, so maybe php is just skipping it somehow: https://github.com/lexbor/lexbor/blob/9283215c15c3c7a5106a1a1e3ff16ff89900a1a5/source/lexbor/html/tree_res.h#L31
PHP Version
8.4.5
Operating System
No response