Couple of thoughts:

* Are we sure that this won't apply to too many edits? I guess in general, I'm sufficiently fuzzy on how often `addBeforeID()` will apply relative to various sequences of edits that could happen to know for sure that it's okay to set the beforeID, beforeText, etc. on all those edits. (That said, I guess it seems clear that if it's appropriate to set the `beforeID` on an edit, it's appropriate to set `beforeText` when we hit this case as well.)
* It occurs to me that `addBeforeID()` might be clearer if it were called `finalizeNewEdits()` or something like that. Also, `fixupElementInsert()` might apply to multiple edits, so maybe it should be `fixupNewElementInserts()`?
* Down below, where you handle `newEdits` that are still around when we hit the end of the child list, should you delete `beforeText` there as well? (I don't think it will matter on the browser side since there will be no `beforeID`, but it might clarify things.)