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

Ignore bare closing tags in html-like input #1926

Merged
merged 2 commits into from Aug 3, 2017

Conversation

Projects
None yet
2 participants
@rreusser
Copy link
Contributor

commented Aug 2, 2017

See #1923. This PR modifies svg text utils to ignore dangling closing tags when there's nothing on the stack.

@@ -400,7 +400,12 @@ function buildSVGText(containerNode, str) {
}

function exitNode(type) {
// A bare closing tag can't close the root node. If we encounter this it
// means there's an extra closing tag that can just be ignored:
if(nodeStack.length === 1) return;

This comment has been minimized.

Copy link
@alexcjohnson

alexcjohnson Aug 2, 2017

Contributor

do you want to log this like we do below for if(type !== innerNode.type)? Though, we don't do anything with this so maybe we should get rid of them both...

This comment has been minimized.

Copy link
@rreusser

rreusser Aug 2, 2017

Author Contributor

That seems reasonable. Do those log messages show up on-screen? Does that seem desirable?

This comment has been minimized.

Copy link
@alexcjohnson

alexcjohnson Aug 2, 2017

Contributor

just in the console, but I think they also go to sentry when they happen on plot.ly

This comment has been minimized.

Copy link
@rreusser

rreusser Aug 2, 2017

Author Contributor

Sounds good.

This comment has been minimized.

Copy link
@alexcjohnson

alexcjohnson Aug 2, 2017

Contributor

or maybe not... not really sure, I haven't looked there. But anyway Lib.log points to console.trace if it exists, otherwise it falls back on console.log

This comment has been minimized.

Copy link
@rreusser

rreusser Aug 2, 2017

Author Contributor

Added message "Ignoring unexpected end tag </...>"

@alexcjohnson

This comment has been minimized.

Copy link
Contributor

commented Aug 2, 2017

Nice catch and nice fix! 💃

@rreusser rreusser merged commit df5face into master Aug 3, 2017

1 check passed

ci/circleci Your tests passed on CircleCI!
Details

@rreusser rreusser deleted the fix-invalid-html-input branch Aug 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.