fix($location): don't call `indexOf()` of undefined `href` attribute

Closes #7721
Closes #8681
fix($location): consider baseHref in realtive link for legacy browsers
Use cached value of baseHref instead of calculating it
Add test for html5mode fallback with base path