vaderjs 1.9.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +9 -5
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -185,8 +185,8 @@ interface SwitchProps {
|
|
|
185
185
|
// make children optional
|
|
186
186
|
export function Switch({ children = [] }: SwitchProps) {
|
|
187
187
|
for (let child of children) {
|
|
188
|
-
if (child
|
|
189
|
-
return child
|
|
188
|
+
if (child.props.when) {
|
|
189
|
+
return child
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
return { type: "div", props: {}, children: [] };
|
|
@@ -620,9 +620,13 @@ export class Component {
|
|
|
620
620
|
const handler = attributes[key];
|
|
621
621
|
this.eventRegistry.set(el, [...(this.eventRegistry.get(el) || []), { event: eventType, handler }]);
|
|
622
622
|
this.addEventListener(el, eventType, handler);
|
|
623
|
-
} else if (attributes[key] !== null && attributes[key] !== undefined
|
|
624
|
-
|
|
625
|
-
|
|
623
|
+
} else if (attributes[key] !== null && attributes[key] !== undefined &&
|
|
624
|
+
!key.includes(" ") || !key.includes("-") || !key.includes("_")) {
|
|
625
|
+
try {
|
|
626
|
+
el.setAttribute(key, attributes[key]);
|
|
627
|
+
} catch (error) {
|
|
628
|
+
|
|
629
|
+
}
|
|
626
630
|
}
|
|
627
631
|
}
|
|
628
632
|
|