Issue #1591πŸ’¬ AnsweredOpened Nov 18, 2018by riteshdalal0 reactions

Component attributes forced to lowercase on load when using fromElement

Quick answerby artf

Expected behavior would be that the attribute name would remain unchanged. This is how HTML5 works

Read full answer below ↓

Question

When GrapesJs is initialized using "fromElement", the attributes in the HTML tags of the element are forced to lowercase.

View live example (uses latest version): https://codesandbox.io/s/zr139yj3m3

Look at the index.html file and the on-Tap property of the div. But upon initializing, if you view the code using the export command, you will see that the attribute has been changed to on-tap.

Expected behavior would be that the attribute name would remain unchanged.

Answers (3)

artfβ€’ Nov 19, 2018

Expected behavior would be that the attribute name would remain unchanged.

This is how HTML5 works

riteshdalalβ€’ Nov 19, 2018

Thanks @artf. If I create a trait with camelcase name then it seems to be working fine when value added through "Settings" but when element is initialized on canvas or block is dropped then the name is forced lowercase.

I am trying to get Angular attributes added to the template - like *ngIf - can you please suggest a good way forward.

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.