When applying text or attribute value edits, decode entities

For #4676. @dangoor 

Note that in the unit tests, we can't use the standard `outerHTML`-based comparison to verify the result, because looking at `outerHTML` will re-encode some characters as entities.