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

Code for SVGElement.attr missing trailing "$" in regex test when handling named symbols #6463

Closed
matt-hoskins opened this Issue Mar 14, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@matt-hoskins

matt-hoskins commented Mar 14, 2017

Expected behaviour

E.g. set rotation attribute on a named symbol SVGElement to a value and have that attribute change be processed.

Actual behaviour

Value is discarded because the attribute begins with the letter 'r' and the regex in question (line 485 in master SvgRender.js) is missing a trailing $:

                                if (this.symbolName && /^(x|y|width|height|r|start|end|innerR|anchorX|anchorY)/.test(key)) {
					if (!hasSetSymbolSize) {
						this.symbolAttr(hash);
						hasSetSymbolSize = true;
					}
					skipAttr = true;
                                }

So the "r" part of the pattern would match a key of e.g. "rotation" and set skipAttr to true as there's no "$". symbolAttr will only process the attributes specifically named in the list in the regex so the attribute setting of rotation doesn't happen.

I would guess it's an accident that the trailing "$" isn't there rather than by design.

@TorsteinHonsi

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Mar 15, 2017

Collaborator

Thanks, that's a good catch! Yes I assume you're right about this.

Collaborator

TorsteinHonsi commented Mar 15, 2017

Thanks, that's a good catch! Yes I assume you're right about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment