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

Use the right attribute - maxlength instead of maxLength #1464

Merged

Conversation

shubham88fru
Copy link
Contributor

@shubham88fru shubham88fru commented Jul 22, 2024

Fixes #1459

Issue: maxLength attribute is being read instead of the correct maxlength attribute.

@shubham88fru shubham88fru changed the title Use the right attribute - maxlength instead of `maxLength Use the right attribute - maxlength instead of maxLength Jul 22, 2024
@NullVoxPopuli
Copy link
Collaborator

is there a way to test that maxLength is wrong or unsupported somehow?

@shubham88fru
Copy link
Contributor Author

shubham88fru commented Jul 23, 2024

is there a way to test that maxLength is wrong or unsupported somehow?

@NullVoxPopuli per MDN, the actual attribute is maxlength and not maxLength.
Now the reason that it still worked with maxLength was because el.getAttribute(arg) internally lowercases whatever arg was passed (check this point in MDN) effectively converting maxLength to maxlength. So to your point, maxLength is technically wrong but didn't break anything yet because of the lowercasing done by el.getAttribute().

However, for the sake of consistency and correctness, I suggest that we change the attribute to the right value, which is maxlength.

Note that in the same file, the same attribute is also read at a different place correctly -

const maxlength = element.getAttribute('maxlength');

Does that answer your question? Sorry if I misunderstood what you were asking.

@NullVoxPopuli NullVoxPopuli merged commit 32f186a into emberjs:master Jul 23, 2024
2 of 4 checks passed
@github-actions github-actions bot mentioned this pull request Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Read "maxlength" attribute instead of "maxLength" in "-guard-for-maxlength.ts"
2 participants