Created attachment 157856 [details]
Demonstrates odd behavior of buttons inside contentEditable regions
I would normally expect a button's onclick handler to fire prior to any in-browser modification of the current DOM selection. For some odd reason, in WebKit, the reverse occurs—the selection changes first—leading to spectacular misbehavior if you're crazy enough to place a button inside a contentEditable region. :-)
Test case attached. The expected behavior is that when you click inside the text above, then click the button, the click event should fire first, causing the content to be inserted at the selection point. Instead, the insertion point moves first, so that the insertion point is inside the text of the button. Thus, the content gets inserted inside the button.
See also: bug 93674. Perhaps we match IE here, as well?
IE doesn't change the selection until click event either.