More complete regex for element attribute name validation

pull/4650/head
Daniel Imfeld 6 years ago
parent 1c3044486f
commit 5494fda8ca

@ -379,7 +379,7 @@ export default class Element extends Node {
} }
if (/[{}]/.test(name)) { if (/(^[0-9-.])|[\^$@%&#?!|()\[\]{}^*+~;]/.test(name)) {
component.error(attribute, { component.error(attribute, {
code: `illegal-attribute`, code: `illegal-attribute`,
message: `'${name}' is not a valid attribute name`, message: `'${name}' is not a valid attribute name`,

@ -1,6 +1,6 @@
[{ [{
"code": "illegal-attribute", "code": "illegal-attribute",
"message": "'a}a' is not a valid attribute name", "message": "'3aa' is not a valid attribute name",
"start": { "start": {
"line": 1, "line": 1,
"column": 3, "column": 3,
@ -8,8 +8,8 @@
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 6, "column": 12,
"character": 6 "character": 12
}, },
"pos": 3 "pos": 3
}] }]

@ -1,7 +1,6 @@
[ [{
{
"code": "illegal-attribute", "code": "illegal-attribute",
"message": "'a{a' is not a valid attribute name", "message": "'a*a' is not a valid attribute name",
"start": { "start": {
"line": 1, "line": 1,
"column": 3, "column": 3,

@ -1,6 +1,6 @@
[{ [{
"code": "illegal-attribute", "code": "illegal-attribute",
"message": "'}a' is not a valid attribute name", "message": "'-a' is not a valid attribute name",
"start": { "start": {
"line": 1, "line": 1,
"column": 3, "column": 3,

@ -1,6 +1,6 @@
[{ [{
"code": "illegal-attribute", "code": "illegal-attribute",
"message": "'a}' is not a valid attribute name", "message": "'a;' is not a valid attribute name",
"start": { "start": {
"line": 1, "line": 1,
"column": 3, "column": 3,
@ -8,8 +8,8 @@
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 5, "column": 11,
"character": 5 "character": 11
}, },
"pos": 3 "pos": 3
}] }]

Loading…
Cancel
Save