Change record status: 
Project: 
Introduced in branch: 
8.9.x
Introduced in version: 
8.9.0
Description: 

Added theme function (Drupal.theme.formLabel) to render label elements with JavaScript. Any instances where label elements were rendered with JavaScript should be updated to use this theme function.

Before
const $label = $('<label class="form-label" for="checkbox1"></label>').text(Drupal.t('Select this option'));

After

const $label = $(Drupal.theme('formLabel', {
  label: Drupal.t('Select this option'),
  properties: {
    className: 'form-label',
    labelFor: 'checkbox1'
  }
}));
Impacts: 
Module developers
Themers