Skip to content

Commit

Permalink
Simplify lookup in radio conditional reveal sync
Browse files Browse the repository at this point in the history
Use document.getElementById rather than document.querySelector which requires us to manually prepend the hash to get an ID selector.
  • Loading branch information
36degrees authored and lfdebrux committed Jul 30, 2021
1 parent 1bb86f6 commit 261cbd3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/govuk/components/radios/radios.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Radios.prototype.syncAllConditionalReveals = function () {
* @param {HTMLInputElement} $input Radio input
*/
Radios.prototype.syncConditionalRevealWithInputState = function ($input) {
var $target = document.querySelector('#' + $input.getAttribute('aria-controls'))
var $target = document.getElementById($input.getAttribute('aria-controls'))

if ($target && $target.classList.contains('govuk-radios__conditional')) {
var inputIsChecked = $input.checked
Expand Down

0 comments on commit 261cbd3

Please sign in to comment.