Use indexes in .children, not .childNodes, for attribute preservation

The difference is that .children excludes non-element nodes (text nodes
and comment nodes). These can't have attributes anyway, so there's
nothing lost by skipping them, and this way we avoid bugs where a
text node split causes the indexes to be off.

(Text node splits are probably due to an interaction between whitespace
preservation and paragraph unwrapping, and aren't necessarily bad. We
just shouldn't rely on indexes into .childNodes)

Change-Id: I905a50e1c299ebafcbd4eaa0f938b06a1b5849ff