diff --git a/Uri/UriFactory.js b/Uri/UriFactory.js index 4ebe7a3..64b19be 100644 --- a/Uri/UriFactory.js +++ b/Uri/UriFactory.js @@ -197,8 +197,8 @@ export class UriFactory return toMatch[match]; } else if (typeof UriFactory.uri[match] !== 'undefined') { return UriFactory.uri[match]; - } else if (match.indexOf('#') === 0) { - const e = document.getElementById(match.substr(1)); + } else if (match.indexOf('!') === 0) { + const e = document.querySelector(match.substr(1)); if (!e) { return ''; @@ -218,6 +218,8 @@ export class UriFactory return value; } else if (match.indexOf('?') === 0) { return HttpUri.getUriQueryParameter(current.query, match.substr(1)); + } else if (match.indexOf('#') === 0) { + return HttpUri.getFragment(); } else if (match.indexOf('/') === 0) { return 'ERROR PATH'; } else if (match === '%') { diff --git a/tests/Uri/UriFactoryTest.js b/tests/Uri/UriFactoryTest.js index 1020db0..e60c578 100644 --- a/tests/Uri/UriFactoryTest.js +++ b/tests/Uri/UriFactoryTest.js @@ -62,7 +62,7 @@ describe('UriFactoryTest', function () { it('Testing global queries', function () { - let uri = 'www.test-uri.com?id={@ID}&test={.mTest}&two={/path}&hash={#hash}&none=#none&found={/not}?v={/valid2}', + let uri = 'www.test-uri.com?id={@ID}&test={.mTest}&two={/path}&hash={!#hash}&none=#none&found={/not}?v={/valid2}', vars = { '@ID' : 1, '.mTest': 'someString',