Browse files

Adds a changs contentTag helper to better support select tags.

  • Loading branch information...
1 parent 5cdbd3e commit 30d95069a51450bf1e51a1202896eca7ed88c54f @MiguelMadero committed Sep 29, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/template/helpers/utils.js
View
12 lib/template/helpers/utils.js
@@ -51,7 +51,8 @@ exports.tags = {
htmlOptions = htmlOptions || {};
var selfClosing = (tag in this.selfClosingTags) ? this.selfClosingTags[tag] : undefined
- , tagOptions;
+ , tagOptions
+ , i;
if (selfClosing) {
htmlOptions[selfClosing.content] = htmlOptions[selfClosing.content] || content || false;
@@ -62,6 +63,15 @@ exports.tags = {
if (tag === 'img') {
htmlOptions.alt = htmlOptions.alt === '' ? htmlOptions.alt : htmlOptions.alt || content;
}
+ if(tag === 'select') {
+ if(content === '' && htmlOptions.options){
+ for (i in htmlOptions.options) {
+ content += '<option>'+htmlOptions.options[i]+'</option>';
+ }
+ htmlOptions.options = undefined;
+ }
+ }
+
tagOptions = this.tagOptions(htmlOptions);
content = this.preContentStrings[tag] ?

0 comments on commit 30d9506

Please sign in to comment.