Skip to content

Commit

Permalink
Fixed problems with the SynchronousScrollerUtility.js and the SiteAcc…
Browse files Browse the repository at this point in the history
…essDifferencesHighlighter.js

JS:

- SiteAccessDifferencesHighlighter.js: When the highlighting state is stored in the url, then the execution of the highlighting will now take place after every parameter has loaded (changed from: Immediately prior to any other JS) in order to ensure parameters not being marked as additions, when the counterpart just hasn't loaded yet

- SynchronousScrollerUtility.js: Functionality to check for the correct list to add to has received a fix where top nodes at the top of the list, which are unique to one list, would not be added to the counterpart list and instead caused the functionality to throw an error
  • Loading branch information
JAC - Frederic Bauer committed Dec 15, 2020
1 parent d4288bc commit 66e038e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ class SiteAccessDifferencesHighlighter {

setUpHighlighterButton() {
this.flipListener(false);
const highlight = this.utility.getStateFromUrl("highlight");

if (highlight) {
this.differenceHighlightButton.click();
}
window.addEventListener("load", () => {
if (this.utility.getStateFromUrl("highlight")) {
setTimeout(() => {
this.differenceHighlightButton.click();
});
}
});
}

highlightDifferencesAndSimilarities() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,11 +568,8 @@ class SynchronousScrollerUtility {
* @returns {null|HTMLElement} Returns the list the node can be added in or null, if no adequate container could be found.
*/
confirmListToAddToOrDeliverNewOne(nodeToAdd, listToBeAddedTo) {
if (nodeToAdd && listToBeAddedTo) {
if (
nodeToAdd.parentElement &&
listToBeAddedTo.classList.contains("param_list_items")
) {
if (nodeToAdd && listToBeAddedTo && nodeToAdd.parentElement) {
if (listToBeAddedTo.classList.contains("param_list_items")) {
const nodeParent = nodeToAdd.parentElement;
const keyOfParent = nodeParent.children[0];

Expand All @@ -594,6 +591,12 @@ class SynchronousScrollerUtility {
} else {
return listToBeAddedTo;
}
} else if (
listToBeAddedTo.classList.contains("param_list") &&
nodeToAdd.parentElement.classList.contains("param_list") &&
listToBeAddedTo !== nodeToAdd.parentElement
) {
return listToBeAddedTo;
}
}

Expand Down

0 comments on commit 66e038e

Please sign in to comment.