| 202 | |
| 203 | // Actual implementation |
| 204 | export function h(type: any, propsOrChildren?: any, children?: any): VNode { |
| 205 | try { |
| 206 | // #6913 disable tracking block in h function |
| 207 | setBlockTracking(-1) |
| 208 | const l = arguments.length |
| 209 | if (l === 2) { |
| 210 | if (isObject(propsOrChildren) && !isArray(propsOrChildren)) { |
| 211 | // single vnode without props |
| 212 | if (isVNode(propsOrChildren)) { |
| 213 | return createVNode(type, null, [propsOrChildren]) |
| 214 | } |
| 215 | // props without children |
| 216 | return createVNode(type, propsOrChildren) |
| 217 | } else { |
| 218 | // omit props |
| 219 | return createVNode(type, null, propsOrChildren) |
| 220 | } |
| 221 | } else { |
| 222 | if (l > 3) { |
| 223 | children = Array.prototype.slice.call(arguments, 2) |
| 224 | } else if (l === 3 && isVNode(children)) { |
| 225 | children = [children] |
| 226 | } |
| 227 | return createVNode(type, propsOrChildren, children) |
| 228 | } |
| 229 | } finally { |
| 230 | setBlockTracking(1) |
| 231 | } |
| 232 | } |