From 101012e6c3765a428c8989ab441af1d7c02dc1ea Mon Sep 17 00:00:00 2001 From: Nate Abele Date: Thu, 17 Apr 2014 06:58:14 -0400 Subject: [PATCH] perf($urlRouter): only call $location.port() once --- src/urlRouter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/urlRouter.js b/src/urlRouter.js index 750470242..e4a76524f 100644 --- a/src/urlRouter.js +++ b/src/urlRouter.js @@ -393,8 +393,8 @@ function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) { return url; } - var slash = (!isHtml5 && url ? '/' : ''), - port = $location.port() == 80 || $location.port() == 443 ? '' : ':' + $location.port(); + var slash = (!isHtml5 && url ? '/' : ''), port = $location.port(); + port = (port === 80 || port === 443 ? '' : ':' + port); return [$location.protocol(), '://', $location.host(), port, slash, url].join(''); }