File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
modules/angular2/src/core/dom Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -426,13 +426,12 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
426426 return window.location;
427427 }
428428
429- getBaseHref () {
429+ String getBaseHref () {
430430 var href = getBaseElementHref ();
431431 if (href == null ) {
432432 return null ;
433433 }
434- var baseUri = Uri .parse (href);
435- return baseUri.path[0 ] == '/' ? baseUri.path : ('/' + baseUri.path);
434+ return _relativePath (href);
436435 }
437436
438437 resetBaseElement () {
@@ -487,3 +486,14 @@ String getBaseElementHref() {
487486 }
488487 return baseElement.getAttribute ('href' );
489488}
489+
490+ // based on urlUtils.js in AngularJS 1
491+ AnchorElement _urlParsingNode = null ;
492+ String _relativePath (String url) {
493+ if (_urlParsingNode == null ) {
494+ _urlParsingNode = new AnchorElement ();
495+ }
496+ _urlParsingNode.href = url;
497+ var pathname = _urlParsingNode.pathname;
498+ return (pathname[0 ] == '/' ) ? pathname : '/${pathname }' ;
499+ }
You can’t perform that action at this time.
0 commit comments