When using beta feature "Wikitext syntax highlighting", the system always asks for confirmation when trying to close an edit page, even when no changes have been made.
I think there is no need to ask for confirmation in such case. When someone goes to an edit page without actually editing anything, they probably only want to see how a specific wikitext/code was written, and hence it is unnecessary to warn them when they close the tab, because they wouldn't lose any data if they did so.