We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
8.4.5
No response
The text was updated successfully, but these errors were encountered:
Fix phpGH-18090: DOM: Svg attributes and tag names are being lowercased
cf14a79
0154bb5
647baec
Merge branch 'PHP-8.4'
d7e2f28
* PHP-8.4: Fix GH-18090: DOM: Svg attributes and tag names are being lowercased
nielsdos
Successfully merging a pull request may close this issue.
Description
All attributes are being lowercased, but for svg elements they should have correct casing (e.g. viewbox should be viewBox).
Browser repro:
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
The text was updated successfully, but these errors were encountered: