Skip to content

Commit 84f5200

Browse files
committed
update handleResultDropdown function
1 parent abdd6ba commit 84f5200

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

web-components/nav-header/nav-header.js

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -139,24 +139,12 @@ function createComponent(html) {
139139
* @param {event} event - User event
140140
*/
141141
function handleResultDropdown(event) {
142-
const button = event.target;
143-
const parent = button.parentElement;
144-
const grandparent = parent.parentElement;
145-
let arrow;
146-
let description;
147-
148-
// Check if user clicked on button - assign variables
149-
if (button.classList.contains('cordion')) {
150-
arrow = button.firstChild;
151-
description = parent.nextElementSibling;
152-
// If user clicked on icon, change variable assignment
153-
} else {
154-
arrow = button;
155-
description = grandparent.nextElementSibling;
156-
}
142+
const button = event.currentTarget;
143+
const arrow = button.firstChild;
144+
const desc = button.parentElement.nextElementSibling;
157145
// Rotate arrow and display/hide result description
158146
arrow.classList.toggle('rotArrow');
159-
description.classList.toggle('search_content_drop');
147+
desc.classList.toggle('search_content_drop');
160148
}
161149
}
162150
}

0 commit comments

Comments
 (0)