Skip to content

Commit

Permalink
Use element properties instead of attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Aug 16, 2024
1 parent fa311f9 commit ae2f0c7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/webp-uploads/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ function webp_uploads_use_picture_element_callback(): void {
} else if ( checkbox.checked && ! document.getElementById( pictureElementHiddenId ) ) {
// The hidden input is only needed if the value was originally set (i.e. the checkbox enabled).
const hiddenInput = document.createElement( 'input' );
hiddenInput.setAttribute( 'type', 'hidden' );
hiddenInput.setAttribute( 'id', pictureElementHiddenId );
hiddenInput.setAttribute( 'name', checkbox.getAttribute( 'name' ) );
hiddenInput.setAttribute( 'value', checkbox.getAttribute( 'value' ) );
hiddenInput.type = 'hidden';
hiddenInput.id = pictureElementHiddenId;
hiddenInput.name = checkbox.name;
hiddenInput.value = checkbox.value;
checkbox.parentElement.insertBefore( hiddenInput, checkbox.nextSibling );
}
} );
Expand Down

0 comments on commit ae2f0c7

Please sign in to comment.