name attribute on <div> elements is not accessible via this.name

Created on 20 March 2025, 18 days ago

Problem/Motivation

element.find('[name]') selects all elements with a name attribute, including divs, form elements, etc. However, this.name only works for form elements, returning undefined for non-form elements like divs

Steps to reproduce

So, we're using drupal/better_exposed_filters along with a Links widget, and 'Allow multiple selections' is disabled. The issue was that we couldn't deselect an already selected filter

Proposed resolution

this.getAttribute('name') should work for reading the name attribute from div elements as well

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024