Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By nod_ on
Change record status:
Draft (View all draft change records)
Project:
Introduced in branch:
8.1.x
Introduced in version:
Issue links:
Description:
Introducing a new parameter, behaviorList
in Drupal.attachBehavior
and Drupal.detachBehavior
, and a new function Drupal.behaviorList
.
// Call a subset of behaviors on the page.
Drupal.attachBehaviors(document, drupalSettings, ['AJAX', 'editor', 'formUpdated', 'escapeAdmin']);
// Override default behavior ordering.
Drupal.behaviorList = function (event, trigger) { return myCustomOrderedBehaviorsArray; };
The new API makes it possible to override the list and order of behaviors that run.
Impacts:
Module developers