Skip to content

"Uncaught TypeError: n.attributes[e.name].each is not a function" when changing history actions for a repeater control #9313

@parasshah195

Description

@parasshah195

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest stable version of Elementor.

Description

Note: The issue is related to editor JS (i.e. only happens during JS render)

The problem occurs when one of the repeater controls is changed/added/removed and then a user goes to History and clicks on a previous action (i.e. undo / Ctrl+Z, but manually).

When this is done, Elementor re-processes the CSS style for that element (because of element onRender -> renderUI -> renderStyles -> getStyleControls).

In the getStyleControls function, it is assumed that the control is a normal control and there's no check if it's a repeater.

So, when it comes to Line 128 (in that function) to process that control's CSS, it throws an error because it gets a repeater object instead of the expected Backbone Collection.

For normal repeater widgets with no CSS selector child controls, this is fine, but for the repeaters which have controls with CSS Selectors, it does not revert back to the previous state CSS (because of this error) and it messes up the Element's CSS output in Editor.

Steps to reproduce

(Keep the Browser Console open)

  1. Add any repeater Widget (for eg: Icon List).
  2. Change any repeater control setting / add / delete a repeater item.
  3. Go to History (from bottom navigation bar, option besides responsive mode icon), and go 1 action back (so that the action is the previous state of the repeater).
  4. The error Uncaught TypeError: n.attributes[e.name].each is not a function will appear in console.

Elementor Repeater History Actions Error

Isolating the problem

  • This bug happens with only Elementor plugin active (and Elementor Pro).
  • This bug happens with a default WordPress theme active.
  • I can reproduce this bug consistently using the steps above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates a bug with one or multiple components.status/mergedIndicates when a Pull Request has been merged to a Release.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions