Commit 09f0d50a authored by catch's avatar catch
Browse files

Revert "Issue #3347144 by dgtlmoon, mstrelan, Evaldas Užkuras, bkosborne,...

Revert "Issue #3347144 by dgtlmoon, mstrelan, Evaldas Užkuras, bkosborne, FeyP, pirvudoru: Form API #states property/states should use .once() to apply its rules (Can cause failures with BigPipe and possibly other situations)"

This reverts commit d6b6ad8f.

(cherry picked from commit 37718084)
parent f3e4294c
Loading
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -93,16 +93,15 @@
   */
  Drupal.behaviors.states = {
    attach(context, settings) {
      const elements = once('states', '[data-drupal-states]', context);
      const il = elements.length;

      const $states = $(context).find('[data-drupal-states]');
      const il = $states.length;
      for (let i = 0; i < il; i++) {
        const config = JSON.parse(
          elements[i].getAttribute('data-drupal-states'),
          $states[i].getAttribute('data-drupal-states'),
        );
        Object.keys(config || {}).forEach((state) => {
          new states.Dependent({
            element: $(elements[i]),
            element: $($states[i]),
            state: states.State.sanitize(state),
            constraints: config[state],
          });
@@ -121,7 +120,7 @@
   *
   * @constructor Drupal.states.Dependent
   *
   * @param {{state: Drupal.states.state, constraints: *, element: (*|jQuery|HTMLElement)}} args
   * @param {object} args
   *   Object with the following keys (all of which are required)
   * @param {jQuery} args.element
   *   A jQuery object of the dependent element
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ class JavascriptStatesTest extends WebDriverTestBase {
  /**
   * {@inheritdoc}
   */
  protected static $modules = ['form_test', 'big_pipe'];
  protected static $modules = ['form_test'];

  /**
   * {@inheritdoc}