Range.surroundContents() should check for partially contained non-Text nodes first, before checking the type of the newParent parameter:
https://dom.spec.whatwg.org/#dom-range-surroundcontents (step 1 and 2)
Firefox and Chrome follow the specification.
Created attachment 261767 [details]
Comment on attachment 261767 [details]
Clearing flags on attachment: 261767
Committed r190139: <http://trac.webkit.org/changeset/190139>
All reviewed patches have been landed. Closing bug.