mithril-node-render
Advanced tools
Comparing version 0.2.0 to 0.2.1
14
index.js
@@ -40,10 +40,10 @@ 'use strict'; | ||
var styles = attrs.style; | ||
if (typeof styles === 'string') { | ||
return ' style="' + styles + '"'; | ||
if (typeof styles === 'object') { | ||
styles = Object.keys(styles).map(function(property) { | ||
return [camelToDash(property).toLowerCase(), styles[property]].join(':'); | ||
}).join(';'); | ||
} | ||
return ' style="' + Object.keys(styles).map(function(property) { | ||
return [camelToDash(property).toLowerCase(), styles[property]].join(':'); | ||
}).join(';') + '"'; | ||
return ' style="' + escapeHtml(styles) + '"'; | ||
} | ||
return ' ' + (name === 'className' ? 'class' : name) + '="' + attrs[name] + '"'; | ||
return ' ' + escapeHtml(name === 'className' ? 'class' : name) + '="' + escapeHtml(attrs[name]) + '"'; | ||
}).join(''); | ||
@@ -83,3 +83,3 @@ } | ||
var children = createChildrenContent(view); | ||
if (!children && VOID_TAGS.indexOf(view.tag) >= 0) { | ||
if (!children && VOID_TAGS.indexOf(view.tag.toLowerCase()) >= 0) { | ||
return '<' + view.tag + createAttrString(view.attrs) + '>'; | ||
@@ -86,0 +86,0 @@ } |
{ | ||
"name": "mithril-node-render", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Node rending of mithril views", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -43,3 +43,6 @@ 'use strict'; | ||
t.equal(render(m('div', '<foo></foo>')), '<div><foo></foo></div>'); | ||
t.equal(render(m('div', { | ||
style: '"></div><div a="' | ||
})), '<div style=""></div><div a=""></div>'); | ||
t.end(); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6776
122