Issue #6646πŸ’¬ AnsweredOpened Nov 11, 2025by soul-media0 reactions

Javascript error when I want to add padding

Quick answerby trebor94

I've been running into the same issue and also using the grapesjs-mjml plugin. Apparently it only occurs when a project is loaded which has the style property present on the attributes of a component when the project is loaded. After each change made within the editor, the style property will be extended with the old...

Read full answer below ↓

Question

GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome & Firefox Reproducible demo link Describe the bug How to reproduce the bug? Chrome & Firefox: Add padding to a image / Text Sometimes the error occurs, sometimes it doesn't. https://github.com/user-attachments/assets/01270f08-974d-4898-bde0-83233f9258e0 What is the current behavior? Chrome The error looks looks like this: Uncaught InvalidCharacterError: Failed to execute 'setAttribute' on 'Element': '0' is not a valid attribute name. This is what the text looks like before I add padding. Th...

Answers (3)

trebor94β€’ Dec 10, 2025

I've been running into the same issue and also using the grapesjs-mjml plugin. Apparently it only occurs when a project is loaded which has the style property present on the attributes of a component when the project is loaded. After each change made within the editor, the style property will be ex...

trebor94β€’ Dec 16, 2025

Unfortunately haven't been able to figure out where or when exactly the style property gets added to the component style when exporting project data from a previously loaded project. Maybe someone else can pinpoint what causes the issue. @soul-media : for what it's worth, patching the init method o...

GJS Helperβ€’ May 17, 2026

It appears you've encountered a bug in GrapesJS, specifically when working with MJML components and applying styles like padding, which leads to invalid attributes being generated and stored. This issue seems to be a regression, as it works in older versions (0.22.2) but fails in newer ones. Root C...

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

Premium plugins ship with support, regular updates, and production-ready features β€” save days of integration work.

Browse premium plugins β†’

Related tutorials

In-depth guides on the same topic.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.