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
"name" variable shows even when empty data sent #103
Comments
You mean the value of ${name} shows up as "data-id"? If you are passing in {}, then it is perhaps because you have something which sets a global variable 'name'. |
Just a suggestion, but you can just send through null instead of {}, as the template engine works with the jQuery.data() property system, thus the data-id as (data-id-variable: data-value-variable) :) So basically your code will be:
|
Is the problem perhaps with jQuery itself? "name" is not undefined on the global space on jquery.com, etc. @JCInteractive, when passing null the problem remains. |
Can you put a complete (but minimal) test case which shows the issue, on jsbin or jsfiddle? It is not possible to determine the cause of the problem just from the gist above.... |
In the Chrome developer tools console the global "name" variable was still showing a value of "data-id", even when I cleared my web app entirely (i.e. a blank page with zero JavaScript). I suspected it had to do something with a Chrome extension. After disabling my extensions and then re-enabling them, and then restarting my browser, there is no longer a problem. Oddly, the global "name" variable still is defined as a blank string in Chrome on every site, even with all extensions disabled. Sorry if this is no help. Feel free to close the issue at your discretion. |
Yup - seems not to be anything to do with templates. Closing. |
name is a property of the window object. |
I have a template that sometimes I need to render without sending any data to it. When I do so (either by sending no second parameter or by sending {}), the "name" template variable shows up as "data-id". Any ideas?
Here is my template:
https://gist.github.com/963527
Here is my render code:
$.tmpl('userTemplate').appendTo($('#user_add'))
The text was updated successfully, but these errors were encountered: