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

Fixed: IE8/IE9 cannot use <template id="my-template"> instead of <script id="my-template"> #1783

Closed
franktopel opened this issue May 6, 2015 · 4 comments · Fixed by #1785

Comments

@franktopel
Copy link
Contributor

Wrapping templates in <template>-tags instead of <script type="text/html">-tags does not work in Internet Explorer 8 and 9.

Supporting IE 8 and 9 in your knockout project forces you to use <script>-tags to wrap your templates. Using <template>-tags leads to these templates being evaluated at page load rather than when the template is being instantiated at run-time - which ofc leads to the bindings within the template failing because in most cases there will not yet be data/the objects being used available.

@mbest
Copy link
Member

mbest commented May 6, 2015

Implementation note: This should be as simple as adding <template> to the list of elements to skip while binding, in addition to <script> and <textarea>.

franktopel added a commit to franktopel/knockout that referenced this issue May 7, 2015
@franktopel
Copy link
Contributor Author

I've tested your suggestion and it looks like that's all that must be done.

I've forked bindingAttributeSyntax.js and implemented your suggested fix in the fork:

https://github.com/knockout/knockout/blob/32628d0d8ce1089555eccfcfdacb8fc860edcbf2/src/binding/bindingAttributeSyntax.js

Hope this helps, though I'm unsure if I applied the right process for contributing a fix since this is my first submission ever.

@franktopel franktopel changed the title IE 8 / 9 cannot use <template id="my-template"> instead of <script id="my-template"> Fixed: IE 8 / 9 cannot use <template id="my-template"> instead of <script id="my-template"> May 7, 2015
@franktopel franktopel changed the title Fixed: IE 8 / 9 cannot use <template id="my-template"> instead of <script id="my-template"> Fixed: IE8/IE9 cannot use <template id="my-template"> instead of <script id="my-template"> May 7, 2015
@franktopel
Copy link
Contributor Author

I've added a pull request for the fix: https://github.com/knockout/knockout/pull/1785/files

@mbest
Copy link
Member

mbest commented May 7, 2015

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants