#1080 parse pattern attribute correctly

This commit is contained in:
Leo Horie 2016-06-01 15:42:08 -04:00
parent b128fd8232
commit 80349b3c74
4 changed files with 10 additions and 6 deletions

View file

@ -84,7 +84,7 @@
function parseTagAttrs(cell, tag) {
var classes = []
var parser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g
var parser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g
var match
while ((match = parser.exec(tag))) {
@ -95,8 +95,9 @@
} else if (match[1] === ".") {
classes.push(match[2])
} else if (match[3][0] === "[") {
var pair = /\[(.+?)(?:=("|'|)(.*?)\2)?\]/.exec(match[3])
cell.attrs[pair[1]] = pair[3] || ""
var attrValue = match[6]
if (attrValue) attrValue = attrValue.replace(/\\(["'])/g, "$1")
cell.attrs[match[4]] = attrValue || ""
}
}