MCPcopy Create free account
hub / github.com/cyclejs/cyclejs / call

Method call

dom/src/VNodeWrapper.ts:10–31  ·  view source on GitHub ↗
(vnode: VNode | null)

Source from the content-addressed store, hash-verified

8 }
9
10 public call(vnode: VNode | null): VNode {
11 if (vnode === null) {
12 return this.wrap([]);
13 }
14 const {tagName: selTagName, id: selId} = selectorParser(vnode);
15 const vNodeClassName = classNameFromVNode(vnode);
16 const vNodeData = vnode.data || {};
17 const vNodeDataProps = vNodeData.props || {};
18 const {id: vNodeId = selId} = vNodeDataProps;
19
20 const isVNodeAndRootElementIdentical =
21 typeof vNodeId === 'string' &&
22 vNodeId.toUpperCase() === this.rootElement.id.toUpperCase() &&
23 selTagName.toUpperCase() === this.rootElement.tagName.toUpperCase() &&
24 vNodeClassName.toUpperCase() === this.rootElement.className.toUpperCase();
25
26 if (isVNodeAndRootElementIdentical) {
27 return vnode;
28 }
29
30 return this.wrap([vnode]);
31 }
32
33 private wrap(children: Array<VNode>) {
34 const {tagName, id, className} = this.rootElement;

Callers 3

patchEventMethod · 0.45
createMatchesSelectorFunction · 0.45
DOMDriverFunction · 0.45

Calls 1

wrapMethod · 0.95

Tested by

no test coverage detected