Direct observation of intramolecular atomic motion in H2 and D2 by using electron-atom Compton scattering