Remove class attribute when comparing navigations.

Moves the logic of "sanitizing" navigation for comparison into an inline
function.
Closes #440.