question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide support for passing an ID selector to $.templates() even when using JsRender without jQuery

See original GitHub issue

https://jsfiddle.net/gvLrdysz/1/

jsrender.templates("#foo").render({})

without jQuery, the above just returns "#foo"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
BorisMoorecommented, Jan 27, 2021

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!

0reactions
BorisMoorecommented, Jan 28, 2021
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found