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

Deep copy token.attrs to avoid mutating token stream #745

Closed
wants to merge 1 commit into from

Conversation

hukkin
Copy link
Contributor

@hukkin hukkin commented Dec 20, 2020

Please correct me if I'm wrong but I believe this line

tmpAttrs[i][1] += ' ' + options.langPrefix + langName;
will currently mutate the token stream.

This PR makes a deep copy of token.attrs so that mutating tmpAttrs[i] will not mutate token.attrs[i]

puzrin pushed a commit that referenced this pull request Dec 20, 2020
@puzrin
Copy link
Member

puzrin commented Dec 20, 2020

Thanks! I did it a bit more light way.

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 this pull request may close these issues.

None yet

3 participants