can't access select on simplerSelectChildCreated event

Created on 19 June 2024, 6 months ago
Updated 5 September 2024, 3 months ago

I try to get select element from event.$wrapper like expose in this change record https://www.drupal.org/node/3221708 but I can only have the label.

I finally found what's get wrong.
The event is trigger before the select is append to the wrapper.
When changing operations order, things get ok.

Changing

      this.$element.trigger(jQuery.Event(`${pluginName}ChildCreated`, { $wrapper }));

      return $wrapper
        .append($select)
        .insertAfter($element);

in

      $wrapper.append($select);
      this.$element.trigger(jQuery.Event(`${pluginName}ChildCreated`, { $wrapper }));

      return $wrapper
        .insertAfter($element);

in build/jquery.simpler-select.js (and build/jquery.simpler-select.js.map and frontend/src/jquery.simpler-select.ts) make it work.

Regards

Remaining task

1. Build js & map.js file.
2. Commit those files.

🐛 Bug report
Status

Needs review

Version

4.0

Component

Code

Created by

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024