Don't loop over objects with a for in loop
This caused a bug in our application since we are using some package that adds properties to the object prototype. When trying to initialize a grapes.js editor we get an error in the console.
Read full answer below ↓Question
Version: 0.16.22
Are you able to reproduce the bug from the demo?
[-] Yes [ ] No
What is the expected behavior?
Looping over objects should be done using Object.keys.forEach..., and not with a for-in loop.
Looping over objects with a for in loop will include properties that are inherited through the prototype chain. This behavior can lead to unexpected items in your for loop. More details can be found here.
Are you able to attach screenshots, screencasts or a live demo?
[ ] Yes (attach) [-] No
Answers (1)
This caused a bug in our application since we are using some package that adds properties to the object prototype. When trying to initialize a grapes.js editor we get an error in the console.

Related Questions and Answers
Continue research with similar issue discussions.
Issue #3065
BUG: gjs-hovered is not being removed when cursor leaves the layers
Version: 0.16.22 Are you able to reproduce the bug from the demo? [x] Yes [ ] No What is the expected behavior?Hover over body in the layer...
Issue #3622
I18n functionality
Version: latest Are you able to reproduce the bug from the demo?[] Yes[ ] No What is the expected behavior? to editor.I18n.setLocale("es")...
Issue #3681
Textable not working with extended text component
Version: 0.17.22 Are you able to reproduce the bug from the demo?[X] Yes[ ] No What is the expected behavior? Should be able to drop a text...
Issue #3441
Parser breaks `mj-style` as of 16.30
Version: All Grapesjs version from 16.30 to now have this issues. Are you able to reproduce the bug from the demo?[x] Yes[ ] No What is the...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.