More of an "out of curiosity question", when creating a kendoUI external (script) template, they say to use this syntax:
<script type="text/x-kendo-template" id="templateNameHere">
<p>html here</p>
#= whatever #
</script>
One of the things I dislike about this type is that the html / etc comes out all black (in Visual Studio).
I've noticed that if I change it to the more typical: type="text/html" the HTML is colorful, and at least will be able to show html structure mistakes, missing comma's/quotes, etc etc. All the usual stuff.
<script type="text/html" id="templateNameHere">
// now HTML has its usual colors, validation, etc
Example of it working with type="text/html"
Kendo Templating still works when used in this format, does anyone know if it is okay to just keep it this way? Can't find any documentation online saying otherwise!
This is a good question. As far as I know there is no real downside in changing it to "text/html", other than it's no longer explicitly marked as being a Kendo template. Whether this is a problem or not depends on whether you use any other kind of client side templating engine concurrently.
The tag "x-kendo-template" is not referenced anywhere in the Kendo source, so is not explicitly being used and is more than likely only there so that the browser ignores that section, as no browsers have built in support for parsing a script block of type "x-kendo-type". The same holds true for "text/html", you just get more syntax highlighting in Visual Studio. If you feel that the benefit of some extra syntax highlighting outweighs that of the block no longer being explicitly marked as a Kendo template, I would go for it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With