According to the current scientific theory of the solar system's formation, which of the following accounts for the composition of the largest planets?

A. They collected most of the more massive elements from the stellar nebula.

B. They were part of another colliding gaseous stellar nebula that contained only lighter elements.

C. They collected huge numbers of rocky meteorites and converted them to gases.

D. They formed far enough from the Sun to allow the condensation of the lighter gases.