- First commit to issue fork.
- Merge request !9Issue #2880292: Improving bad performance when attaching behaviors. → (Open) created by Zarpele
- last update
about 1 year ago 5 pass - last update
about 1 year ago 5 pass - last update
about 1 year ago 5 pass - 🇦🇷Argentina Zarpele
The last patch was generated from this MR https://git.drupalcode.org/project/chosen/-/merge_requests/9/diffs#note_... I included the last changes and I boosted the performance when attaching Drupal's behaviors. So instead of attaching all the behaviors I just selectively apply the
.chosen
behaviorThat solves bad performance issues when having a lot of components
Drupal.behaviors.chosen.attach(e.target);
Also, I removed these kinds of lines...
$(":visible", e.target).once('js-chosen').each(function(i, target) {
Drupal's behaviors are smart enough to find specific DOM elements on which to act within some big container. So you do not need to search for them and invoke on .each() one of them.
This stuff needs review. Thanks
- First commit to issue fork.