fix valueless attributes #1093
This commit is contained in:
parent
2289061f90
commit
3cf16631a0
2 changed files with 2 additions and 5 deletions
|
|
@ -97,7 +97,7 @@
|
||||||
} else if (match[3][0] === "[") {
|
} else if (match[3][0] === "[") {
|
||||||
var attrValue = match[6]
|
var attrValue = match[6]
|
||||||
if (attrValue) attrValue = attrValue.replace(/\\(["'])/g, "$1")
|
if (attrValue) attrValue = attrValue.replace(/\\(["'])/g, "$1")
|
||||||
cell.attrs[match[4]] = attrValue || ""
|
cell.attrs[match[4]] = attrValue || true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ describe("m()", function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("sets attr without a value as an empty string", 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 () {
|
it("sets correct single quoted attr", function () {
|
||||||
|
|
@ -48,9 +48,6 @@ describe("m()", function () {
|
||||||
it("sets correct double quoted attr", function () {
|
it("sets correct double quoted attr", function () {
|
||||||
expect(m("[title=\"bar\"]")).to.have.deep.property("attrs.title", "bar")
|
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 () {
|
it("sets correct children with 1 string arg", function () {
|
||||||
expect(m("div", "test"))
|
expect(m("div", "test"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue