This commit is contained in:
2025-12-03 01:49:25 +02:00
parent 0b2a982ca3
commit ff99f32630
+8 -6
View File
@@ -11,12 +11,14 @@ export class AppendOptions {
}
if (Ut.isStr(data)) {
data.replace(/"((?:\\.|[^"\\])*)"\s*:\s*"((?:\\.|[^"\\])*)"/g, (_, rawKey, rawVal) => target.append(
new Option(
JSON.parse(`"${rawVal}"`),
JSON.parse(`"${rawKey}"`)
)
));
let options = '';
data.replace(/"((?:\\.|[^"\\])*)"\s*:\s*"((?:\\.|[^"\\])*)"/g,
(_, k, v) => (options += `<option value="${JSON.parse(`"${k}"`)}">${JSON.parse(`"${v}"`)}</option>`, '')
);
target.innerHTML = options;
return;
}