Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use correct case for XML (SVG) elements #447

Merged
merged 3 commits into from
May 9, 2020

Conversation

klemens
Copy link
Contributor

@klemens klemens commented May 9, 2020

Previously XML elements which use some upper case letters would be converted to all-lowercase during string parsing. As xml is case-sensitive, this breaks the element. An example is the XML linearGradient.

This was caused by the code incorrectly converting all element names to lowercase to ensure HTML tags are correctly assigned, as they use lower case internally, but the browser function tagName returns all caps for HTML tags.

The first two commits fix this, while the last one changes the names of the gradient macros to camel case (like the other svg macros). That last one is also a breaking change.

@klemens klemens mentioned this pull request May 9, 2020
klemens added 2 commits May 9, 2020 19:30
Previously XML elements which use some upper case letters would be
converted to all-lowercase during string parsing. As xml is
case-sensitive, this breaks the element. An example is the XML
linearGradient.

This was caused by the code incorrectly converting all element names to
lowercase to ensure HTML tags are correctly assigned, as they use lower
case internally, but the browser function tagName returns all caps for
HTML tags.

Fix this by only converting HTML element names to lower case.

Fix: seed-rs#377
There were some spelling errors in the list of element names used to
decide if the XML namespace should be assigned to the element.

Note that this fix is not necessary for most modern browsers, as they
already automatically provide the correct namespace for SVG etc.
@klemens klemens force-pushed the fix-xml-element-parsing branch from 87ad4a8 to 1f8038a Compare May 9, 2020 17:31
@MartinKavik
Copy link
Member

Very nice! I just learned new stuff about Svg and Seed code 😄
Please update changelog and I'll merge it.

@klemens klemens force-pushed the fix-xml-element-parsing branch from 1f8038a to a418702 Compare May 9, 2020 17:57
@MartinKavik MartinKavik merged commit 601c71e into seed-rs:master May 9, 2020
@klemens klemens deleted the fix-xml-element-parsing branch May 10, 2020 12:47
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants