Merge pull request #1411 from barneycarroll/allow-verbose-class-attribute-declaration-next

Allow verbose class attribute declaration (next)
This commit is contained in:
Leo Horie 2016-11-22 00:32:11 -05:00 committed by GitHub
commit 9263b23c04
4 changed files with 5 additions and 3 deletions

View file

@ -112,7 +112,8 @@
} else if (match[3].charAt(0) === "[") { // #1195
var attrValue = match[6]
if (attrValue) attrValue = attrValue.replace(/\\(["'])/g, "$1")
cell.attrs[match[4]] = attrValue || true
if (match[4] === "class") classes.push(attrValue)
else cell.attrs[match[4]] = attrValue || true
}
}

2
mithril.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -9,6 +9,7 @@
test(function () { return m("div").tag === "div" })
test(function () { return m(".foo").tag === "div" })
test(function () { return m(".foo").attrs.className === "foo" })
test(function () { return m("[class=a]").attrs.className === "a" })
test(function () { return m("[title=bar]").tag === "div" })
test(function () { return m("[title=bar]").attrs.title === "bar" })
test(function () { return m("[empty]").attrs.empty === true })