fix(page-data): isolate invalid workspace bindings
This commit is contained in:
@@ -47,13 +47,17 @@ export function detectPageDataDatasetUsageFromHtml(html) {
|
||||
// this API must therefore only require the safe, default capability.
|
||||
remember(match[1], { softDelete: true });
|
||||
}
|
||||
for (const match of text.matchAll(/\.insertRow\(\s*([A-Za-z_$][\w$]*)/g)) {
|
||||
// `${...}` inside an HTML template literal is a row-id interpolation, not a
|
||||
// JavaScript identifier passed as the dataset argument. Without this guard,
|
||||
// snippets such as `onclick="deleteRow(${row.id})"` are detected as a `$`
|
||||
// dataset and can make the whole workspace binding pass fail.
|
||||
for (const match of text.matchAll(/\.insertRow\(\s*(?!\$\{)([A-Za-z_$][\w$]*)/g)) {
|
||||
remember(constants.get(match[1]) ?? match[1], { insert: true });
|
||||
}
|
||||
for (const match of text.matchAll(/\.listRows\(\s*([A-Za-z_$][\w$]*)/g)) {
|
||||
for (const match of text.matchAll(/\.listRows\(\s*(?!\$\{)([A-Za-z_$][\w$]*)/g)) {
|
||||
remember(constants.get(match[1]) ?? match[1], { read: true });
|
||||
}
|
||||
for (const match of text.matchAll(/\.deleteRow\(\s*([A-Za-z_$][\w$]*)/g)) {
|
||||
for (const match of text.matchAll(/\.deleteRow\(\s*(?!\$\{)([A-Za-z_$][\w$]*)/g)) {
|
||||
remember(constants.get(match[1]) ?? match[1], { softDelete: true });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user