updates
This commit is contained in:
@@ -11,13 +11,15 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user