Provide support for passing an ID selector to $.templates() even when using JsRender without jQuery
See original GitHub issuehttps://jsfiddle.net/gvLrdysz/1/
jsrender.templates("#foo").render({})
without jQuery, the above just returns "#foo"
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
JsRender Quickstart
JsRender can be used to render templates on the server (using Node.js) as well as ... The jsrender namespace provides the same methods/APIs...
Read more >Client Insight - Using JsRender with JavaScript and HTML
The template can then be accessed by name and rendered using the $.render.name() syntax. The $.templates function is similar to jQuery methods such...
Read more >Store a jsRender template in a separate js file - Stack Overflow
Yes, you can accomplish this (I use this every time). let's assume that you have your templates in a template folder and it...
Read more >Backbone.js
Backbone.js gives structure to web applications by providing models with key-value ... that end up as tangled piles of jQuery selectors and callbacks, ......
Read more >Reducing JavaScript Code Using jsRender Templates in ...
I've had questions come up in the jQuery classes that we offer, ... the DOM using a jQuery selector and that its html()...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
On further thought, I agree with you that reading the docs may make people expect to be able to pass an ID selector for a script block to
$.templates("#myTmpl")
even when jQuery is not loaded.In addition, it is convenient, as an API.
So I am adding support for it, as a feature improvement, in the next update.
I will also update the docs to indicate that other jQuery selectors can be used too, but only if jQuery is loaded.
Thanks for calling this out!
This has been resolved in v1.0.11. See https://www.jsviews.com/#jsr-quickstart@nojquery and https://www.jsviews.com/#compiletmpl@fromscriptblock…