Re-add DOM history change by @okuryu

This was originally overwritten when merging in v3.14.1.