fix valueless attributes #1093

This commit is contained in:
Leo Horie 2016-06-06 09:21:58 -04:00
parent 2289061f90
commit 3cf16631a0
2 changed files with 2 additions and 5 deletions

View file

@ -97,7 +97,7 @@
} else if (match[3][0] === "[") {
var attrValue = match[6]
if (attrValue) attrValue = attrValue.replace(/\\(["'])/g, "$1")
cell.attrs[match[4]] = attrValue || ""
cell.attrs[match[4]] = attrValue || true
}
}

View file

@ -38,7 +38,7 @@ describe("m()", function () {
})
it("sets attr without a value as an empty string", function () {
expect(m("[empty]")).to.have.deep.property("attrs.empty", "")
expect(m("[empty]")).to.have.deep.property("attrs.empty", true)
})
it("sets correct single quoted attr", function () {
@ -48,9 +48,6 @@ describe("m()", function () {
it("sets correct double quoted attr", function () {
expect(m("[title=\"bar\"]")).to.have.deep.property("attrs.title", "bar")
})
it("sets pattern attr", function () {
expect(m("[pattern=\"[a-zA-Z0-9]{56}\"]")).to.have.deep.property("attrs.pattern", "[a-zA-Z0-9]{56}")
})
it("sets correct children with 1 string arg", function () {
expect(m("div", "test"))