#382 don't render single empty space if not needed
This commit is contained in:
parent
4deeeb486b
commit
fed82b2135
2 changed files with 8 additions and 1 deletions
|
|
@ -60,7 +60,9 @@ var m = (function app(window, undefined) {
|
|||
}
|
||||
|
||||
for (var attrName in attrs) {
|
||||
if (attrName === classAttrName) cell.attrs[attrName] = (cell.attrs[attrName] || "") + " " + attrs[attrName];
|
||||
if (attrName === classAttrName) {
|
||||
if (attrs[attrName] !== "") cell.attrs[attrName] = (cell.attrs[attrName] || "") + " " + attrs[attrName];
|
||||
}
|
||||
else cell.attrs[attrName] = attrs[attrName]
|
||||
}
|
||||
return cell
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@ function testMithril(mock) {
|
|||
test(function() {return m("svg", [m("a[href='http://google.com']")])})
|
||||
test(function() {return m(".foo", {"class": "bar"}).attrs["class"] == "foo bar"})
|
||||
test(function() {return m(".foo", {className: "bar"}).attrs.className == "foo bar"})
|
||||
test(function() {return m(".foo", {className: ""}).attrs.className == "foo"})
|
||||
test(function() {return m("div", {className: ""}).attrs.className === undefined}) //https://github.com/lhorie/mithril.js/issues/382
|
||||
test(function() {return m("div", {class: ""}).attrs.className === undefined})
|
||||
test(function() {return m("div", {className: ""}).attrs.class === undefined})
|
||||
test(function() {return m("div", {class: ""}).attrs.class === undefined})
|
||||
|
||||
//m.module
|
||||
test(function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue