Skip to content

Commit 79e738a

Browse files
author
Jacco-V
committed
Change regex to work directly on html-escaped string
1 parent 71288be commit 79e738a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/core/render/utils.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,18 @@ export function getAndRemoveConfig(str = '') {
2323

2424
if (str) {
2525
str = str
26-
.replace(/"/g, '"')
2726
.replace(
28-
/(?:^|\s):([\w-]+:?)=?([\w-%]+|"[^"]*")?/g, // Note: because the provided `str` argument has been html-escaped, with backslashes stripped, we cannot support escaped characters in quoted strings :-(
27+
/(?:^|\s):([\w-]+:?)=?([\w-%]+|"((?!").)*")?/g, // Note: because the provided `str` argument has been html-escaped, with backslashes stripped, we cannot support escaped characters in quoted strings :-(
2928
(m, key, value) => {
3029
if (key.indexOf(':') === -1) {
31-
config[key] = (value && value.replace(/"/g, '')) || true;
30+
config[key] = (value && value.replace(/"/g, '')) || true;
3231
return '';
3332
}
3433

3534
return m;
3635
}
3736
)
3837
.replace(/^('|")|('|")$/g, '')
39-
.replace(/"/g, '"')
4038
.trim();
4139
}
4240

0 commit comments

Comments
 (0)