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

Bad context for <script type="text/html"> #24

Closed
glubo opened this issue Jun 12, 2014 · 3 comments
Closed

Bad context for <script type="text/html"> #24

glubo opened this issue Jun 12, 2014 · 3 comments

Comments

@glubo
Copy link

glubo commented Jun 12, 2014

Latte guesses Javascript context instead of html context inside <script type="text/html">. E.g.

        {$foo}

        <script id="template1" type="text/html">
                {$foo}
        </script>
        <script>
                document.write(document.getElementById('template1').text);
        </script>

Similar construct is used in Knockout JS for templates (see http://knockoutjs.com/documentation/template-binding.html).

I've created a simple demo of this bug: https://github.com/glubo/latte_text_html .

@JanTvrdik
Copy link
Contributor

This is a feature. See http://forum.nette.org/en/18981-how-can-i-disable-the-special-mode-of-latte-in-script-tag for related discussion.

@glubo
Copy link
Author

glubo commented Jun 12, 2014

That does not explain why it is a feature but thanks anyway for heading me towards {contentType html} that is at least valid workaround.

@glubo
Copy link
Author

glubo commented Jun 13, 2014

Thanks a lot! cc67d2a seems to fix this.

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

No branches or pull requests

2 participants