(type, props, key, ref, original)
| 55 | * @returns {import('./internal').VNode} |
| 56 | */ |
| 57 | export function createVNode(type, props, key, ref, original) { |
| 58 | // V8 seems to be better at detecting type shapes if the object is allocated from the same call site |
| 59 | // Do not inline into createElement and coerceToVNode! |
| 60 | /** @type {import('./internal').VNode} */ |
| 61 | const vnode = { |
| 62 | type, |
| 63 | props, |
| 64 | key, |
| 65 | ref, |
| 66 | _children: NULL, |
| 67 | _parent: NULL, |
| 68 | _depth: 0, |
| 69 | _dom: NULL, |
| 70 | _component: NULL, |
| 71 | constructor: UNDEFINED, |
| 72 | _original: original == NULL ? ++vnodeId : original, |
| 73 | _index: -1, |
| 74 | _flags: 0 |
| 75 | }; |
| 76 | |
| 77 | // Only invoke the vnode hook if this was *not* a direct copy: |
| 78 | if (original == NULL && options.vnode != NULL) options.vnode(vnode); |
| 79 | |
| 80 | return vnode; |
| 81 | } |
| 82 | |
| 83 | export function createRef() { |
| 84 | return { current: NULL }; |
no test coverage detected
searching dependent graphs…