In GMail, when I create two paragraphs of text, select them, click Edit Link, and then cancel the Edit Link dialogue, the first paragraph is made into a link. When the Edit Link dialogue appears, GMail creates a link from the selection with document.execCommand("CreateLink", ...), and then when I cancel the dialogue, GMaill tries to remove the link by removing the last anchor in the selection. This won't always unlink the entire selection because we sometimes create multiple anchor elements during CreateLink to preserve the structure of the selection. For example imagine selecting 'foo' and 'bar' below: foo<ul><li>bar</li><li>baz</li></ul> and performing CreateLink. WebKit will create two anchor elements since there is no way to insert only one that contains the entire selection but does not require splitting the list. You could fix this issue by calling document.execCommand("Unlink") on the selection if the user cancels out of the Edit Link dialogue. <rdar://problem/5616266> Gmail: Clicking Cancel in Edit Link dialog applies a link to the first line of selected text
This looks fixed.