-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attributes on a block can't be camelCase #890
Comments
Guessing we might just need an https://github.com/WordPress/gutenberg/blob/a33329c/blocks/api/parser.js#L113 Any reason we might want to avoid that? I could potentially see wanting to be strict on the opening marker and slug cc @nylen |
In the interest of keeping this as specific as possible until we know we need to do otherwise, let's just add Now that I'm looking at that regex again, we support attribute names containing |
When I wrote the original parser I was looking towards the HTML spec and it indicates case insensitivity. I stopped short of implementing the spec since we didn't know what we wanted but it seems reasonable to adopt that same specification here too. |
Worth nothing that, as far as i know, the convention for HTML attributes in core is lowercase and hyphen, nothing else. I'm not saying that it's applied consistently 🙂 |
The major advantage of using The major disadvantage is that it is a further deviation from HTML; personally I think this is OK. -1 on case-insensitivity. |
@nylen was so kind to clarify to me these attributes are used inside HTML comments so I guess we can use whatever we want and they don't need to follow the WP HTML coding standards. |
HTML does not require any case on attributes. they are case insensitive as noted in the spec I linked. That means, if we use With HTML the names of the attributes have a case but the syntax is case-insensitive and we have a guarantee that no two attributes exist whose names only differ in case. |
WordPress does. See: https://make.wordpress.org/core/handbook/best-practices/coding-standards/html/#attributes-and-tags But, as noted above, since these are going to be within HTML comments, I guess ti really doesn't matter. |
perfectly fine, but I was pointing out in response to the claim that this is not an HTML constraint |
Closing since the DOM parser is gone. Let's reopen if we want to add the constraint that |
I found out that if you write your attribute with camelCase (for example
postsToShow
), the DOM parser won't parse the block correctly. Instead, it will show it as a text in the freeform block:/cc @youknowriad
The text was updated successfully, but these errors were encountered: