The 'Cancel' button (or clicking a tab to leave the page) has three buttons:
- an X in the upper right corner
- "Continue editing"
- "Discard edits"
The X probably shouldn't be there at all. However, if it's going to be there, then it should have the same effect as "Continue editing", not "Surprise me by irreversibly discarding all my work when I thought I was just getting rid of the box".