function handlerReturnfunction (prop, ...args) {
    if (!prop) {
        return undefined
    }

    // Is prop in camelCase? If so, convert to kebab-case
    prop = prop.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()

    // Attempt to create an element using the property name.
    const element = document.createElement(prop)

    // console.log(element instanceof HTMLUnknownElement, element.localName, customElements.get(prop))

    // Is the requested element a custom element? (could be either a web component or from a framework)
    // const isCustom = prop.includes('-')

    // If the created element is unknown (i.e. not a valid HTML element),
    // simply ignore it by returning undefined.
    // NB: Elements with a dash are custom elements and always report as known even if not registered.
    if (element instanceof HTMLUnknownElement ) {
        return undefined
    }

    // Process arguments if provided.
    if (args.length) {
        const [first, ...rest] = args

        // If the first argument is an object (but not a Node or an Array),
        // treat it as an attributes/properties map.
        if (
            first &&
            typeof first === 'object' &&
            !Array.isArray(first) &&
            !(first instanceof Node)
        ) {
            // ! Consider forcing attr containing a dash to camelCase
            Object.entries(first).forEach(([attr, value]) => {
                // If the attribute is a known property of the element,
                // assign it directly. Otherwise, use setAttribute.
                if (attr in element) {
                    element[attr] = value
                } else {
                    element.setAttribute(attr, value)
                }
            })
        } else {
            // If the first argument is not an attribute object,
            // treat all arguments as child nodes.
            rest.unshift(first)
        }

        // Append each subsequent argument as a child.
        rest.forEach(child => {
            if (child instanceof Node) {
                element.appendChild(child)
            } else if (typeof child === 'string') {
                // element.appendChild(document.createTextNode(child))
                element.innerHTML = child // WARNING: Unsafe, use DOMPurify if available
            }
        })
    }

    return element
}
Return a function that creates an element with the given name.
If the element name is unknown and does not contain a dash, return undefined.
Element names containing a dash are always treated as custom or framework elements. (no way to differentiate whether they actually exist).
@example dom.div({id: 'myDiv'}, 'Hello World!')
@example dom['my-element']({id: 'myElement'}, 'Hello World!')
@example dom.myElement({id: 'myElement'}, dom.p('<span style="color:red;">Hello</span> World!'))
@param {string} prop The name of the element to create.
@param {object} args The attributes, innerHTML or child nodes for the element.
@returns {HTMLElement|undefined} The created element or undefined if the element is unknown.