mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Improvements to $e
This commit is contained in:
@@ -3356,6 +3356,8 @@ function $e(tag, parent, attributes) {
|
|||||||
|
|
||||||
let element = document.createElement(tag);
|
let element = document.createElement(tag);
|
||||||
|
|
||||||
|
if (!attributes) attributes = {};
|
||||||
|
|
||||||
if ("classes" in attributes) {
|
if ("classes" in attributes) {
|
||||||
if (!Array.isArray(attributes.classes)) throw Error("Classes was not array!");
|
if (!Array.isArray(attributes.classes)) throw Error("Classes was not array!");
|
||||||
for (const className of attributes.classes) {
|
for (const className of attributes.classes) {
|
||||||
@@ -3367,8 +3369,15 @@ function $e(tag, parent, attributes) {
|
|||||||
|
|
||||||
for (const [attribute, value] of Object.entries(attributes)) {
|
for (const [attribute, value] of Object.entries(attributes)) {
|
||||||
if (attribute.includes(".")) {
|
if (attribute.includes(".")) {
|
||||||
console.warn("TODO: Dot syntax");
|
let ref = element;
|
||||||
throw Error("No dot syntax");
|
const parts = attribute.split(".");
|
||||||
|
|
||||||
|
for (const part of parts.slice(0, -1)) {
|
||||||
|
ref = ref[part];
|
||||||
|
}
|
||||||
|
|
||||||
|
ref[parts[parts.length - 1]] = value;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attribute in element) {
|
if (attribute in element) {
|
||||||
|
Reference in New Issue
Block a user