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

Unchaining adds superfluous newlines #9

Open
2 tasks
devbridie opened this issue Jun 26, 2018 · 0 comments
Open
2 tasks

Unchaining adds superfluous newlines #9

devbridie opened this issue Jun 26, 2018 · 0 comments
Labels
bug Something isn't working engine

Comments

@devbridie
Copy link
Owner

devbridie commented Jun 26, 2018

When transforming $("a").hide().hide().hide().hide(), extra newlines will be inserted between each output statement, resulting in the following:

const element = document.querySelectorAll("a");

element.style.display = "none";

element.style.display = "none";

...

As the output will be very verbose with many chained statements, this is undesirable. When removing the outer callExpression so that the outer expression is a memberExpression, no newlines seem to be inserted.

Possible babel-core bug. See related issue.

What is exceptional is that each statement separately will not generate a newline when used with babel-generate to output each statement, however, joining them with insertBefore, insertAfter, or replaceWithMultiple with or without the use of a BlockStatement will cause them to appear.

@devbridie devbridie added bug Something isn't working engine labels Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working engine
Projects
None yet
Development

No branches or pull requests

1 participant