Skip to content
New issue

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

SVG data attributes cause error in Edge #982

Closed
tarjei opened this issue Dec 5, 2017 · 5 comments · Fixed by #995
Closed

SVG data attributes cause error in Edge #982

tarjei opened this issue Dec 5, 2017 · 5 comments · Fixed by #995
Labels

Comments

@tarjei
Copy link

tarjei commented Dec 5, 2017

Hi,
This example does not work in Edge:
https://svelte.technology/repl?version=1.44.2&gist=9c6e3507010663c0ef9e41901736c321

The problem was the attribute data-name. By removing it, I got the component to work in Edge. The error it gave was "Cannot set name on undefined or null reference".

TLDR:
SVGs in components with data-xxx attributes seem to not work in Edge. See here for why:
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/data-*

<p class="footer-text">
            <svg class="footer-cart" xmlns="http://www.w3.org/2000/svg"
								 data-name="This attribute destroyed X-mas!"
             viewBox="0 0 55.8 48.6">
                <title>
                    cart_outline
                </title>
                <path class="cls-1" d="M54.8 16.3H13.6a1 1 0 0 1 0-2H54.8a1 1 0 1 1 0 2Z" ></path>
                <path class="cls-1" d="M47.6 37.9H18.9a1 1 0 0 1-1-0.8L9.2 2H1A1 1 0 0 1 1 0h9a1 1 0 0 1 1 0.8l8.8 35.1H47.6a1 1 0 0 1 0 2Z" ></path>
                <path class="cls-1" d="M20.7 48.6A4.6 4.6 0 1 1 25.3 44 4.6 4.6 0 0 1 20.7 48.6Zm0-7.2A2.6 2.6 0 1 0 23.3 44 2.6 2.6 0 0 0 20.7 41.5Z" ></path>
                <path class="cls-1" d="M44 48.6A4.6 4.6 0 1 1 48.6 44 4.6 4.6 0 0 1 44 48.6Zm0-7.2A2.6 2.6 0 1 0 46.6 44 2.6 2.6 0 0 0 44 41.5Z" ></path>
                <path class="cls-1" d="M52.4 23.6H22.5a1 1 0 0 1 0-2H52.4a1 1 0 0 1 0 2Z" ></path>
                <path class="cls-1" d="M50 30.7H24.3a1 1 0 0 1 0-2H50a1 1 0 1 1 0 2Z" ></path>
	</svg></p>
@PaulBGD PaulBGD changed the title SVG data attributes cause error in IE SVG data attributes cause error in Edge Dec 6, 2017
@Rich-Harris
Copy link
Member

Oh, Edge. You will never be a modern browser.

This'll be easy to fix, but in the meantime you could workaround it by compiling with legacy: true — that causes (among other things) data-footo becomenode.getAttribute('data-foo')rather thannode.dataset.foo`.

@Rich-Harris Rich-Harris added the bug label Dec 6, 2017
@tarjei
Copy link
Author

tarjei commented Dec 6, 2017 via email

@Rich-Harris
Copy link
Member

fixed in 1.46.1

@tarjei
Copy link
Author

tarjei commented Dec 10, 2017

Thanks!

@sysmaya
Copy link

sysmaya commented Dec 3, 2022

<title> Is'nt SVG valid element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants