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

Escape "</script" when inlining strings #384

Merged
merged 3 commits into from
Jan 24, 2017
Merged

Escape "</script" when inlining strings #384

merged 3 commits into from
Jan 24, 2017

Conversation

kangax
Copy link
Member

@kangax kangax commented Jan 20, 2017

Fixes #382

@@ -112,6 +112,12 @@ module.exports = ({ types: t, traverse }) => {
}
}

// https://github.com/babel/babili/issues/382
if (typeof res.value === "string" &&
res.value.indexOf("</script") > -1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use includes instead of indexof since we are already targeting node 4?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

includes was introduced in node 6

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah...I know that..But we are transpiling the code to node 4.. So it shouldnt be a problem

@goto-bus-stop
Copy link
Contributor

should this also account for the <!-- case mentioned in #382 (comment) ?

@kangax
Copy link
Member Author

kangax commented Jan 24, 2017

We could just use jsesc then. Especially since it's already used by Babel.

@kangax kangax merged commit 17eba03 into master Jan 24, 2017
@kangax kangax deleted the escape branch January 24, 2017 17:33
@boopathi boopathi added the Tag: Bug Fix Pull Request fixes a bug label Jan 25, 2017
boopathi added a commit that referenced this pull request Apr 3, 2017
+ Adds option isScriptContext to constant folding plugin
+ Fix #440, fix #413
+ Related #384, #382
@boopathi boopathi mentioned this pull request Apr 3, 2017
boopathi added a commit that referenced this pull request Apr 4, 2017
+ Adds option isScriptContext to constant folding plugin
+ Fix #440, fix #413
+ Related #384, #382
boopathi added a commit that referenced this pull request Apr 6, 2017
* Make jsesc isScriptContext optional

+ Adds option isScriptContext to constant folding plugin
+ Fix #440, fix #413
+ Related #384, #382

* Remove jsesc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tag: Bug Fix Pull Request fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants