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 use does not repaint in firefox upon second update #101

Open
AndyOGo opened this issue Apr 18, 2018 · 3 comments · May be fixed by #102
Open

SVG use does not repaint in firefox upon second update #101

AndyOGo opened this issue Apr 18, 2018 · 3 comments · May be fixed by #102

Comments

@AndyOGo
Copy link

AndyOGo commented Apr 18, 2018

I just started using nanomorph and I have a simple test by changing the icon of an SVG icon sprite every second. Works perfectly in latest chrome but not in Firefox - see screencasts below:

[Edit]: I just realised that the xlink:href attribute isn't updated.

I use it to build Custom-elements with incremental rendering:
axa-ch-webhub-cloud/pattern-library#411

Latest Chrome:
incremental-icon-chrome

Latest Firefox:
incremental-icon-firefox-stops

@AndyOGo
Copy link
Author

AndyOGo commented Apr 18, 2018

I opened my debugger and tracked it down, it seems to be caused by setting namespaced attributes without it's namespace, but rather by it's local name (it works in chrome because SVG's recent version of <use> tag dropped the xlink:href in favor of href)

https://github.com/choojs/nanomorph/blob/master/lib/morph.js#L50-L51

firefox-ns-attributes-updates

@AndyOGo
Copy link
Author

AndyOGo commented Apr 18, 2018

Very interesting the DOM spec of getAttributeNS and setAttributeNS seems to be irritating.
https://dom.spec.whatwg.org/#dom-element-getattributens

getAttributeNS(namespace, localName)
https://www.w3.org/TR/DOM-Level-2-Core/glossary.html#dt-localname
A local name is the local part of a qualified name. This is called the local part in Namespaces in XML [Namespaces].

setAttributeNS(namespace, qualifiedName, value)
https://www.w3.org/TR/DOM-Level-2-Core/glossary.html#dt-qualifiedname
A qualified name is the name of an element or attribute defined as the concatenation of a local name (as defined in this specification), optionally preceded by a namespace prefix and colon character. See Qualified Names in Namespaces in XML [Namespaces].

@AndyOGo AndyOGo linked a pull request Apr 18, 2018 that will close this issue
@AndyOGo
Copy link
Author

AndyOGo commented Apr 18, 2018

I have just raised the same issue for morphdom patrick-steele-idem/morphdom#124

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

Successfully merging a pull request may close this issue.

1 participant