Skip to content

Commit

Permalink
perf: optimize brisa-element
Browse files Browse the repository at this point in the history
  • Loading branch information
aralroca committed Sep 8, 2024
1 parent c172d4c commit 01a994a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/brisa/src/utils/brisa-element/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ const SUSPENSE_PROPS = 'l';
const NULL = null;
const CONTEXT = 'context';

const isObject = (o: unknown) => typeof o === 'object';
const isReactiveArray = (a: any) => a?.some?.(isObject);
const arr = Array.from;
const isCustomEvent = (e: unknown): e is CustomEvent =>
e instanceof CustomEvent;
const isFunction = (fn: unknown) => typeof fn === 'function';
const isAttributeAnEvent = (key: string) => key.startsWith('on');
const appendChild = (parent: HTMLElement | DocumentFragment, child: Node) =>
parent.appendChild(child);

export default function brisaElement(
render: Render,
observedAttributes: string[] = [],
Expand Down Expand Up @@ -97,16 +107,6 @@ export default function brisaElement(
};
}

const isObject = (o: unknown) => typeof o === 'object';
const isReactiveArray = (a: any) => a?.some?.(isObject);
const arr = Array.from;
const isCustomEvent = (e: unknown): e is CustomEvent =>
e instanceof CustomEvent;
const isFunction = (fn: unknown) => typeof fn === 'function';
const isAttributeAnEvent = (key: string) => key.startsWith('on');
const appendChild = (parent: HTMLElement | DocumentFragment, child: Node) =>
parent.appendChild(child);

const createElement = (
tagName: string,
parent?: HTMLElement | DocumentFragment,
Expand Down

0 comments on commit 01a994a

Please sign in to comment.