Consider text nodes when comparing elements