I think the two "thisNode" above should be "element", because "thisNode" is the old node, not the newly created node "element".