Skip to content

Commit

Permalink
Remove deprecated function nodeListForEach
Browse files Browse the repository at this point in the history
Favour using the JavaScript native $nodelist.forEach(...) instead

See alphagov/govuk-frontend#3466
  • Loading branch information
peteryates committed Feb 23, 2024
1 parent c890a0b commit 497b3ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions app/webpacker/packs/country-picker.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { nodeListForEach } from 'govuk-frontend/dist/govuk/common'
import openregisterLocationPicker from 'govuk-country-and-territory-autocomplete'

const $allCountryAutoCompleteElements = document.querySelectorAll('[data-module="app-country-autocomplete"]')

nodeListForEach($allCountryAutoCompleteElements, (component) => {
$allCountryAutoCompleteElements.forEach((component) => {
openregisterLocationPicker({
selectElement: component.querySelector('select'),
url: '/location-autocomplete-graph.json'
Expand Down
5 changes: 2 additions & 3 deletions app/webpacker/packs/itt-provider-picker.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { nodeListForEach } from 'govuk-frontend/dist/govuk/common'
import openregisterLocationPicker from 'govuk-country-and-territory-autocomplete'

const $allIttProvidersAutoCompleteElements = document.querySelectorAll('[data-module="app-itt-provider-autocomplete"]')

nodeListForEach($allIttProvidersAutoCompleteElements, (component) => {
$allIttProvidersAutoCompleteElements.forEach((component) => {
const options = component.querySelectorAll('select option');
const optionsMap = []
nodeListForEach(options, (option) => {
options.forEach((option) => {
optionsMap.push({ search: option.text.toLowerCase(), text: option.text, value: option.value })

if (option.dataset.additionalSynonyms) {
Expand Down

0 comments on commit 497b3ed

Please sign in to comment.