diff --git a/UI/Component/AdvancedInput.js b/UI/Component/AdvancedInput.js index 6f0aead..7ba6946 100644 --- a/UI/Component/AdvancedInput.js +++ b/UI/Component/AdvancedInput.js @@ -22,7 +22,7 @@ export class AdvancedInput this.id = e.id; this.inputComponent = e; this.inputField = this.inputComponent.getElementsByClassName('input')[0]; - this.dropdownElement = document.getElementById(this.id + '-dropdown'); + this.dropdownElement = document.getElementById(this.id + '-popup'); this.tagElement = document.getElementById(this.id + '-tags'); this.dataList = this.dropdownElement.getElementsByTagName('table')[0]; this.dataListBody = this.dataList.getElementsByTagName('tbody')[0]; @@ -41,7 +41,7 @@ export class AdvancedInput if (e.relatedTarget === null || e.relatedTarget.parentElement === null || e.relatedTarget.parentElement.parentElement === null || - !jsOMS.hasClass(e.relatedTarget.parentElement.parentElement.parentElement, 'dropdown') + !jsOMS.hasClass(e.relatedTarget.parentElement.parentElement.parentElement, 'popup') ) { jsOMS.removeClass(self.dropdownElement, 'active'); } diff --git a/UI/Component/AdvancedSelect.js b/UI/Component/AdvancedSelect.js index 6c6d0f7..ff2e786 100644 --- a/UI/Component/AdvancedSelect.js +++ b/UI/Component/AdvancedSelect.js @@ -28,7 +28,7 @@ export class AdvancedSelect this.id = e.id; this.selectComponent = e; this.selectField = this.selectComponent.getElementsByClassName('input')[0]; - this.dropdownElement = document.getElementById(this.id + '-dropdown'); + this.dropdownElement = document.getElementById(this.id + '-popup'); this.tagElement = document.getElementById(this.id + '-tags'); this.dataList = this.dropdownElement.getElementsByTagName('table')[0]; this.dataListBody = this.dataList.getElementsByTagName('tbody')[0]; @@ -47,7 +47,7 @@ export class AdvancedSelect if (e.relatedTarget === null || e.relatedTarget.parentElement === null || e.relatedTarget.parentElement.parentElement === null || - !jsOMS.hasClass(e.relatedTarget.parentElement.parentElement.parentElement, 'dropdown') + !jsOMS.hasClass(e.relatedTarget.parentElement.parentElement.parentElement, 'popup') ) { jsOMS.removeClass(self.dropdownElement, 'active'); } diff --git a/UI/Component/Table.js b/UI/Component/Table.js index ee9f02b..7781217 100644 --- a/UI/Component/Table.js +++ b/UI/Component/Table.js @@ -263,8 +263,10 @@ export class Table if (sortType === 1 && content1 > content2) { shouldSwitch = true; + break; } else if (sortType === -1 && content1 < content2) { shouldSwitch = true; + break; } else { break; } @@ -378,7 +380,10 @@ export class Table for (let i = 0; i < rowLength; ++i) { const box = rows[i].cells[columnId].querySelector('input[type=checkbox]'); - box.checked = status; + + if (box !== null) { + box.checked = status; + } } }); } diff --git a/Uri/HttpUri.js b/Uri/HttpUri.js index ca64b9a..ca308e3 100644 --- a/Uri/HttpUri.js +++ b/Uri/HttpUri.js @@ -44,6 +44,9 @@ export class HttpUri * * @throws {Error} * + * @todo The default parseer fails for uris which have a query without a value but a fragment e.g. ?debug#something. + * In such a case something#something is returned as fragment instead of just #something or something + * * @since 1.0.0 */ static parseUrl (str, mode = 'php') @@ -52,9 +55,9 @@ export class HttpUri 'relative', 'path', 'directory', 'file', 'query', 'fragment' ], parser = { - php: /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, + php: /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, - loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/\/?)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // Added one optional slash to post-scheme to catch file:/// (should restrict this) + loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/\/?)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // Added one optional slash to post-scheme to catch file:/// (should restrict this) }; if (!parser.hasOwnProperty(mode)) { diff --git a/Uri/UriFactory.js b/Uri/UriFactory.js index c6f67f4..c47c805 100644 --- a/Uri/UriFactory.js +++ b/Uri/UriFactory.js @@ -126,11 +126,13 @@ export class UriFactory */ static unique (url) { + // @todo: there is a bug for uris which have a parameter without a value and a fragment e.g. ?debug#something. + // The fragment is ignored in such a case. if (url.includes('?')) { const parsed = HttpUri.parseUrl(url); // unique queries - const parts = parsed.query.replace(/\?/g, '&').split('&'), + const parts = typeof parsed.query === 'undefined' ? [] : parsed.query.replace(/\?/g, '&').split('&'), full = url.split('?')[0], pars = []; @@ -140,12 +142,14 @@ export class UriFactory for (let i = 0; i < length; ++i) { spl = parts[i].split('='); - comps[spl[0]] = spl[1]; + comps[spl[0]] = spl.length < 2 ? '' : spl[1]; } for (const a in comps) { - if (comps.hasOwnProperty(a) && comps[a] !== '' && comps[a] !== null) { + if (comps.hasOwnProperty(a) && comps[a] !== '' && comps[a] !== null && typeof comps[a] !== 'undefined') { pars.push(a + '=' + (comps[a].includes('%') ? comps[a] : encodeURIComponent(comps[a]))); + } else if (comps.hasOwnProperty(a)) { + pars.push(a); } }