Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

Break up script tags to allow inline use #222

Closed
wants to merge 1 commit into from
Closed

Break up script tags to allow inline use #222

wants to merge 1 commit into from

Conversation

doryphores
Copy link

Breaking up the closing <script> tag allows jasmine-query.js to be included inline in a script tag: A closing script tag would cause the browser to believe the script has come to an end.

I have a situation where I couldn't load it externally and it broke my test suite.

Breaking up the closing <script> tag allows this
script to be itself included inline in a script tag.
@travisjeffery
Copy link
Collaborator

wat?

@doryphores
Copy link
Author

I know, it's an odd request. I have a project where I have to render jasmine-query inside a script tag instead of referencing it the normal way. So:

<script>
// jasmine-query goes here along with other scripts
</script>

instead of:

<script src="jasmine-query.js"></script>

If the contents of a script tag include an unescaped closing script tag, it causes the tag to close early. See this stackoverflow answer.

It's a tiny issue but I had to change the file to use it so this may help someone in the future.

@travisjeffery
Copy link
Collaborator

i don't get how this is fixing it though, it ends up being the same string

@doryphores
Copy link
Author

Here's why: http://stackoverflow.com/questions/236073/why-split-the-script-tag-when-writing-it-with-document-write

In my opinion, it's a tiny change that fixes a rare issue and has no side effects. Why reject it?

@doryphores doryphores deleted the escape-script-tags branch September 13, 2015 17:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants