Skip to content
Snippets Groups Projects

Issue #3239161: Refactor (if feasible) uses of the jQuery attr function to use Vanilla/native.

Open Issue #3239161: Refactor (if feasible) uses of the jQuery attr function to use Vanilla/native.
Open Rahul Rasgon requested to merge issue/drupal-3239161:3239161-11.x into 11.x

Closes #3239161

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
17 17 (event) => {
18 18 const $summary = $(event.currentTarget);
19 19 const open =
20 $(event.currentTarget.parentNode).attr('open') === 'open'
20 $(event.currentTarget.parentNode)[0].getAttribute('open') === 'open'
  • 17 17 (event) => {
    18 18 const $summary = $(event.currentTarget);
    19 19 const open =
    20 $(event.currentTarget.parentNode).attr('open') === 'open'
    20 $(event.currentTarget.parentNode)[0].getAttribute('open') === 'open'
    21 21 ? 'false'
    22 22 : 'true';
    23 23
    24 $summary.attr({
    25 'aria-expanded': open,
    26 'aria-pressed': open,
    27 });
    24 $summary[0].setAttribute('aria-expanded', open);
    25 $summary[0].setAttribute('aria-pressed', open);
  • 705 705 if (e.value) {
    706 706 const label = `label${e.target.id ? `[for=${e.target.id}]` : ''}`;
    707 707 const $label = $(e.target)
    708 .attr({ required: 'required', 'aria-required': 'true' })
    709 708 .closest('.js-form-item, .js-form-wrapper')
    710 709 .find(label);
    710 $(e.target)[0].setAttribute('required', 'required');
    711 $(e.target)[0].setAttribute('aria-required', 'true');
  • 30 30 // Add a link before the table for users to show or hide weight columns.
    31 31 this.$link = $(
    32 32 '<button type="button" class="link tableresponsive-toggle"></button>',
    33 )
    34 .attr(
    33 );
    34 this.$link[0].setAttribute(
    35 35 'title',
    36 36 Drupal.t(
    37 37 'Show table cells that were hidden to make the table fit within a small screen.',
    38 38 ),
    39 )
    40 .on('click', this.eventhandlerToggleColumns.bind(this));
    39 );
  • 69 69 // Find all <th> with class select-all, and insert the check all checkbox.
    70 70 $table
    71 71 .find('th.select-all')
    72 .prepend($(Drupal.theme('checkbox')).attr('title', strings.selectAll))
    72 .prepend(
    73 $(Drupal.theme('checkbox'))[0].getAttribute('title', strings.selectAll),
  • 41 41 // Update the view of the trigger.
    42 const $trigger = this.$el.find('.trigger');
    43 $trigger
    44 .each((index, element) => {
    45 element.textContent = Drupal.t(
    46 '@action @title configuration options',
    47 {
    48 '@action': !isOpen
    49 ? this.options.strings.open
    50 : this.options.strings.close,
    51 '@title': this.model.get('title'),
    52 },
    53 );
    54 })
    55 .attr('aria-pressed', isOpen);
    42 const triggerElements = this.$el[0].querySelectorAll('.trigger');
  • 179 179 const ids = [];
    180 180 $placeholders.each(function () {
    181 181 ids.push({
    182 id: $(this).attr('data-contextual-id'),
    183 token: $(this).attr('data-contextual-token'),
    182 id: $(this)[0].getAttribute('data-contextual-id'),
    183 token: $(this)[0].getAttribute('data-contextual-token'),
  • 1019 1019 context,
    1020 1020 ).forEach((checkbox) => {
    1021 1021 const $checkbox = $(checkbox);
    1022 const nameAttribute = $checkbox.attr('name');
    1022 const nameAttribute = $checkbox[0].getAttribute('name');
  • 23 23 const $checkbox = $(checkbox);
    24 24 // Retrieve the tabledrag row belonging to this filter.
    25 25 const $row = $context
    26 .find(`#${$checkbox.attr('id').replace(/-status$/, '-weight')}`)
    26 .find(
    27 `#${$checkbox[0]
    28 .getAttribute('id')
    29 .replace(/-status$/, '-weight')}`,
    30 )
  • 23 23 const $checkbox = $(checkbox);
    24 24 // Retrieve the tabledrag row belonging to this filter.
    25 25 const $row = $context
    26 .find(`#${$checkbox.attr('id').replace(/-status$/, '-weight')}`)
    26 .find(
    27 `#${$checkbox[0]
    28 .getAttribute('id')
    29 .replace(/-status$/, '-weight')}`,
    30 )
    27 31 .closest('tr');
    28 32 // Retrieve the vertical tab belonging to this filter.
    29 33 const $filterSettings = $context.find(
    30 `[data-drupal-selector='${$checkbox
    31 .attr('id')
    34 `[data-drupal-selector='${$checkbox[0]
    35 .getAttribute('id')
  • 63 63 if (query.length >= 2) {
    64 64 // Attribute to note which categories are closed before opening all.
    65 65 $categories
    66 .find('.js-layout-builder-category:not([open])')
    67 .attr('remember-closed', '');
    66 .find('.js-layout-builder-category:not([open])')[0]
  • 63 63 if (query.length >= 2) {
    64 64 // Attribute to note which categories are closed before opening all.
    65 65 $categories
    66 .find('.js-layout-builder-category:not([open])')
    67 .attr('remember-closed', '');
    66 .find('.js-layout-builder-category:not([open])')[0]
    67 .setAttribute('remember-closed', '');
    68 68
    69 69 // Open all categories so every block is available to filtering.
    70 $categories.find('.js-layout-builder-category').attr('open', '');
    70 $categories
    71 .find('.js-layout-builder-category')[0]
  • 213 215 .not(
    214 216 (index, element) =>
    215 217 $(element).closest('[data-contextual-id]').length > 0,
    216 )
    217 .attr('tabindex', -1);
    218 )[0]
  • 431 433 * disable content preview in the Layout Builder UI.
    432 434 */
    433 435 if (!isContentPreview) {
    434 $layoutBuilderContentPreview.attr('checked', false);
    436 $layoutBuilderContentPreview[0].setAttribute('checked', false);
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading