Add TextNode
Use type instead of instanceof