diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /app/assets/javascripts/filtered_search | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'app/assets/javascripts/filtered_search')
-rw-r--r-- | app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js | 32 | ||||
-rw-r--r-- | app/assets/javascripts/filtered_search/services/recent_searches_service_error.js | 7 |
2 files changed, 18 insertions, 21 deletions
diff --git a/app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js b/app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js index d41d5a543b0..5298e20557d 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js +++ b/app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js @@ -95,7 +95,7 @@ export default class FilteredSearchVisualTokens { const tokenType = tokenName.toLowerCase(); const tokenValueContainer = parentElement.querySelector('.value-container'); const tokenValueElement = tokenValueContainer.querySelector('.value'); - tokenValueElement.innerText = tokenValue; + tokenValueElement.textContent = tokenValue; const visualTokenValue = new VisualTokenValue(tokenValue, tokenType, tokenOperator); @@ -140,9 +140,9 @@ export default class FilteredSearchVisualTokens { li.innerHTML = nameHTML + operatorHTML; } - li.querySelector('.name').innerText = name; + li.querySelector('.name').textContent = name; if (hasOperator) { - li.querySelector('.operator').innerText = operator; + li.querySelector('.operator').textContent = operator; } const tokensContainer = FilteredSearchContainer.container.querySelector('.tokens-container'); @@ -162,8 +162,8 @@ export default class FilteredSearchVisualTokens { lastVisualToken.innerHTML = FilteredSearchVisualTokens.createVisualTokenElementHTML({ hasOperator: Boolean(operator), }); - lastVisualToken.querySelector('.name').innerText = name; - lastVisualToken.querySelector('.operator').innerText = operator; + lastVisualToken.querySelector('.name').textContent = name; + lastVisualToken.querySelector('.operator').textContent = operator; FilteredSearchVisualTokens.renderVisualTokenValue(lastVisualToken, name, value, operator); } } @@ -208,8 +208,8 @@ export default class FilteredSearchVisualTokens { }, }); } else { - const previousTokenName = lastVisualToken.querySelector('.name').innerText; - const previousTokenOperator = lastVisualToken.querySelector('.operator').innerText; + const previousTokenName = lastVisualToken.querySelector('.name').textContent; + const previousTokenOperator = lastVisualToken.querySelector('.operator').textContent; const tokensContainer = FilteredSearchContainer.container.querySelector('.tokens-container'); tokensContainer.removeChild(lastVisualToken); @@ -234,7 +234,7 @@ export default class FilteredSearchVisualTokens { const { lastVisualToken } = FilteredSearchVisualTokens.getLastVisualTokenBeforeInput(); if (lastVisualToken && lastVisualToken.classList.contains('filtered-search-term')) { - lastVisualToken.querySelector('.name').innerText += ` ${searchTerm}`; + lastVisualToken.querySelector('.name').textContent += ` ${searchTerm}`; } else { FilteredSearchVisualTokens.addVisualTokenElement({ name: searchTerm, @@ -261,12 +261,12 @@ export default class FilteredSearchVisualTokens { const value = lastVisualToken.querySelector('.value'); const name = lastVisualToken.querySelector('.name'); - const valueText = value ? value.innerText : ''; - const nameText = name ? name.innerText : ''; + const valueText = value ? value.textContent : ''; + const nameText = name ? name.textContent : ''; if (includeOperator) { const operator = lastVisualToken.querySelector('.operator'); - const operatorText = operator ? operator.innerText : ''; + const operatorText = operator ? operator.textContent : ''; return valueText || operatorText || nameText; } @@ -278,7 +278,7 @@ export default class FilteredSearchVisualTokens { const operator = lastVisualToken && lastVisualToken.querySelector('.operator'); - return operator?.innerText; + return operator?.textContent; } static removeLastTokenPartial() { @@ -346,8 +346,8 @@ export default class FilteredSearchVisualTokens { if (token.classList.contains('filtered-search-token')) { FilteredSearchVisualTokens.addFilterVisualToken( - nameElement.innerText, - operatorElement.innerText, + nameElement.textContent, + operatorElement.textContent, null, { uppercaseTokenName: nameElement.classList.contains('text-uppercase'), @@ -359,13 +359,13 @@ export default class FilteredSearchVisualTokens { if (!value) { const valueElement = valueContainerElement.querySelector('.value'); - value = valueElement.innerText; + value = valueElement.textContent; } } // token is a search term if (!value) { - value = nameElement.innerText; + value = nameElement.textContent; } input.value = value; diff --git a/app/assets/javascripts/filtered_search/services/recent_searches_service_error.js b/app/assets/javascripts/filtered_search/services/recent_searches_service_error.js index 011b37e218d..d8c2c6d79c6 100644 --- a/app/assets/javascripts/filtered_search/services/recent_searches_service_error.js +++ b/app/assets/javascripts/filtered_search/services/recent_searches_service_error.js @@ -1,13 +1,10 @@ import { __ } from '~/locale'; -class RecentSearchesServiceError { +class RecentSearchesServiceError extends Error { constructor(message) { + super(message || __('Recent Searches Service is unavailable')); this.name = 'RecentSearchesServiceError'; - this.message = message || __('Recent Searches Service is unavailable'); } } -// Can't use `extends` for builtin prototypes and get true inheritance yet -RecentSearchesServiceError.prototype = Error.prototype; - export default RecentSearchesServiceError; |