apprun 3.28.14 → 3.28.15

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/src/vdom-my.ts CHANGED
@@ -37,22 +37,21 @@ export function createElement(tag: string | Function | [], props?: {}, ...childr
37
37
 
38
38
  const keyCache = new WeakMap();
39
39
 
40
- export const updateElement = (element: Element, nodes: VDOM, component = {}) => {
40
+ export const updateElement = (element: Element | string, nodes: VDOM, component = {}) => {
41
41
  // tslint:disable-next-line
42
42
  if (nodes == null || nodes === false) return;
43
+ const el = (typeof element === 'string' && element) ?
44
+ document.getElementById(element) || document.querySelector(element) : element;
43
45
  nodes = directive(nodes, component);
44
- render(element, nodes, component);
46
+ render(el, nodes, component);
45
47
  }
46
48
 
47
49
  function render(element: Element, nodes: VDOM, parent = {}) {
48
50
  // tslint:disable-next-line
49
51
  if (nodes == null || nodes === false) return;
50
-
51
52
  nodes = createComponent(nodes, parent);
52
-
53
- const isSvg = element?.nodeName === "SVG";
54
-
55
53
  if (!element) return;
54
+ const isSvg = element.nodeName === "SVG";
56
55
  if (Array.isArray(nodes)) {
57
56
  updateChildren(element, nodes, isSvg);
58
57
  } else {