Correcting DOM handling