Navigation Menu

Skip to content
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

Make attribute "charset" valid #1863

Merged
merged 1 commit into from Jun 30, 2018
Merged

Conversation

silvenon
Copy link
Contributor

@silvenon silvenon commented Jun 29, 2018

The attribute charset was considered an error in favor of charSet, but both of them result in valid HTML because HTML is case-insensitive. In other words, these two lines will be interpreted in the same way:

<meta charSet="utf-8" />
<meta charset="utf-8" />

They will render different HTML (exactly like this JSX suggests), but browsers won't care. If nothing else, charset should be the more "correct" form of this attribute because it doesn't suggest a dash (fillOpacity = fill-opacity, charSetchar-set).

facebook/react#11492 (comment)

The attribute "charset" was considered an error, but it results in valid
HTML because HTML is case-insensitive. In other words, these two lines
will be interpreted in the same way:

<meta charSet="utf-8" />
<meta charset="utf-8" />

facebook/react#11492 (comment)
@@ -30,6 +30,8 @@ ruleTester.run('no-unknown-property', rule, {
{code: '<App class="bar" />;'},
{code: '<App for="bar" />;'},
{code: '<App accept-charset="bar" />;'},
{code: '<meta charset="utf-8" />;'},
{code: '<meta charSet="utf-8" />;'},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we should be forcing charset; HTML also supports CHARSET and cHaRsEt, but lowercase is the very dominant convention.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my initial thought, but charSet is not an unknown attribute, as the name of the rule implies. That said, I’ll modify the PR, so you decide. 😉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, that is true. I suppose it’s a slight overreach of this rule to force it.

Copy link
Contributor Author

@silvenon silvenon Jun 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. As much as I would like for people to write charset instead of charSet, raising an error because of that would not be symmetrical with raising an error for acceptcharset in favor of acceptCharset, because only the latter results into the correct form of the attribute – accept-charset.

I'll hold with the changes then until we agree what they should be.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need, i think this makes sense as-is

Copy link
Collaborator

@EvHaus EvHaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ljharb ljharb merged commit 809a25d into jsx-eslint:master Jun 30, 2018
@silvenon silvenon deleted the meta-charset branch July 1, 2018 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants