Fix selective serialization with cached page DOM

Fix several bugs in the use of cached HTML for selective serialization that
prevented it from being used at all.

Change-Id: I83f291aaf929ca86f5f6f9d2eeaeed99cb68bbcd