Commit 2558fc7b authored by Bryce Johnson's avatar Bryce Johnson

Break out removalValidator.

parent a6db3bcc
......@@ -334,14 +334,19 @@ class FilteredSearchManager {
this.clearSearch();
}
removalValidator(token) {
const isToken = token.classList.contains('js-visual-token');
return this.customRemovalValidator ? (isToken && this.customRemovalValidator(token)) : isToken;
}
clearSearch() {
this.filteredSearchInput.value = '';
const removeElements = [];
const customValidator = this.customRemovalValidator || function (t) { return true };
[].forEach.call(this.tokensContainer.children, (t) => {
if (t.classList.contains('js-visual-token') && customValidator(t)) {
if (this.removalValidator(t)) {
removeElements.push(t);
}
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment