modify an existing dom tree