WebAPIKit icon indicating copy to clipboard operation
WebAPIKit copied to clipboard

Function appendChild(node: Node) return wrong type

Open bestwnh opened this issue 2 years ago • 0 comments

The appendChild(node: Node) for Node return type should be same as the child, not the parent. Now if you use the div element to add a span, it would cause error. I'm currently using a method below instead.

func addNode<T: Node>(_ node: T) -> T {
    let result = self.jsValue.appendChild(node.jsValue)
    return T.init(from: result)!
}

bestwnh avatar Dec 06 '23 08:12 bestwnh