Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dermatthes committed Oct 25, 2023
1 parent b3026a2 commit c1739f3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/processor/jodastyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class Jodastyle {
// Wait for all joda-split to be ready
for (let child of Array.from(node.getElementsByTagName("joda-split"))) {
while (child["ready"] !== true) {
await ka_sleep(5);
await ka_sleep(10);
}
}

Expand All @@ -29,13 +29,17 @@ export class Jodastyle {
});

// Run jodastyle commands
for (let child of [node, ...Array.from(node.querySelectorAll<HTMLElement>("*"))]) {
for (let child of [node, ...Array.from(node.children)] as HTMLElement[]) {
if (child["joda-style-processed"] === true) {
continue;
}
child["joda-style-processed"] = true;

let style = getComputedStyle(child);
let parentStyle = null;
if (child.parentElement) {
parentStyle = getComputedStyle(child.parentElement);
}


let keys = Object.keys(jodaStyleCommands);
Expand All @@ -45,17 +49,17 @@ export class Jodastyle {
if (styleValue === "") {
continue;
}
if (styleValue === getComputedStyle(child.parentElement).getPropertyValue(key)) {
if (parentStyle !== null && styleValue === parentStyle.getPropertyValue(key)) {
continue; // Inherited from parent
}

// Replace starting and ending with " or ' with nothing
styleValue = getCleanVariableValue(styleValue)

//await ka_sleep(10);
let command = jodaStyleCommands[key];
try {
child = await command(styleValue, node as HTMLDivElement, child, this.logger) as HTMLElement;

} catch (e) {
if (e instanceof JodaElementException) {
e.triggerCommand = key + ": " + styleValue;
Expand Down

0 comments on commit c1739f3

Please sign in to comment.