only record document changes for non-null keys
Merge pull request #4044 from dloverin/fix-ctrl-space

only record document changes for non-null keys