Comments (6)
Are you using stock handlebars or handlebars with SproutCore?
from handlebars.js.
Plain ol' handlebars.
On May 6, 2011, at 11:14 PM, [email protected] wrote:
Are you using stock handlebars or handlebars with SproutCore?
Reply to this email directly or view it on GitHub:
#76 (comment)
from handlebars.js.
I have this issue too. I'm using only handlebars on my application.
Only one expression is evalued, the another still the same. It only occurs on Firefox.
from handlebars.js.
I wrote a small (and probably convoluted) helper that gets around the problem, but is in no way ideal.
Handlebars.registerHelper('selectBox', function(context){
var result = "<select";
if ( context.parameters != null ) {
for (var i=0; i<context.parameters.length; i++) {
result = result + " "+context.parameters[i].property+"=\""+context.parameters[i].value+"\"";
}
}
result = result + ">";
for (var i=0; i<context.options.length; i++) {
result = result + "<option";
if ( context.options[i].parameters != null ) {
for (var p=0; p<context.options[i].parameters.length; p++) {
result = result + " "+context.options[i].parameters[p].property+"=\""+context.options[i].parameters[p].value+"\"";
}
}
result = result + ">" + context.options[i].text + "</option>";
}
return result + "</select>";
});
The above helper using this example context:
selectBoxContext = {
"parameters": [
{
"property": "name",
"value": "thisIsAName"
},
{
"property": "id",
"value": "thisIsAnID"
}
],
"options": [
{
"parameters": [
{
"property": "value",
"value": "1value"
},
{
"property": "id",
"value": "1id"
}
],
"text": "1display"
},
{
"parameters": [
{
"property": "value",
"value": "2value"
},
{
"property": "id",
"value": "2id"
}
],
"text": "2display"
}
]
};
with this as your HandleBars:
{{#selectBox selectBoxContext}}{{/selectBox}}
will produce the following HTML:
<select id="thisIsAnID" name="thisIsAName">
<option id="1id" value="1value">1display</option>
<option id="2id" value="2value">2display</option>
</select>
All in all, not the most pretty solution but solves the problem for now. I'll dig through the source sometime this weekend and if I find a fix, I'll request a pull.
from handlebars.js.
Can someone who had this issue create a JSFiddle that illustrates the problem?
from handlebars.js.
This issue appears to be dead. If someone is still having problems, please submit a jsfiddle and I'll reopen.
from handlebars.js.
Related Issues (20)
- Removal of dependency on wordwrap library HOT 2
- Trying to get in touch regarding a security issue HOT 1
- Is it possible to disable control flow statements?
- result of template({}) is cached
- Rendering precompiled templates on the server, runtime export HOT 1
- Link Issue HOT 1
- Partials are too slow
- Add automated fuzzing HOT 2
- Use type `Record<string, any>` for `HelperOptions.hash` HOT 1
- Why on earth would you write something without as as basic a thing as a conditional like if/then/else??? HOT 1
- how to insert `{{xxx}}}`
- Add access to current json selection key in helpers (expressions and blocks) HOT 1
- vulnerable version of uglify-js: 3.1.4 HOT 1
- Enhance `showPosition()` to Accurately Display Error Position by Line Number HOT 13
- www.handlebarsjs.com is giving me an SSL error (without www is working fine) HOT 1
- pass variables to precompiled template
- Extra } not part of template causing errors HOT 1
- Compatibility Issue with `robloach/component-installer` and Composer 2.x HOT 1
- Extend Each helper's support for Maps using `as | value key |`
- Whitespace control in one {{else if}} branch also affects a different branch
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.