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

Replace _ with - in Symbol attribute values #766

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

joeldrapper
Copy link
Collaborator

@joeldrapper joeldrapper commented Sep 5, 2024

This provides better consistency with Symbol keys and makes it easier to work with standard multi-word HTML attribute values, such as contenteditable: :plaintext_only.

This provides better consistency with Symbol keys and makes it easier to work with standard multi-word HTML attribute values, such as `content_editable: :plaintext_only`.
Copy link
Contributor

@willcosgrove willcosgrove left a comment

Choose a reason for hiding this comment

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

Looks great! I don't think I've ever run into this, but I think I would have expected it to work the way that this PR changes it to work. 🎉

@joelmoss
Copy link
Contributor

joelmoss commented Sep 5, 2024

Am I missing something, but what happened to the process_attributes hook?

@willcosgrove
Copy link
Contributor

@joelmoss it was renamed: #653 (comment)

@joeldrapper
Copy link
Collaborator Author

The process_attributes hook was removed. You can achieve the same by patching __attributes__ but this is a private API and may change in the future.

@joelmoss
Copy link
Contributor

joelmoss commented Sep 5, 2024

I missed that, but when and why was it removed? I rely on that and don't like the idea of monkey patching (__attributes__) private API :(

@joeldrapper
Copy link
Collaborator Author

FWIW, it’s very unlikely we’ll rename __attributes__ in the future, and it’s very likely to continue to be sent a single hash argument, which you can format before passing up to super.

@joeldrapper joeldrapper merged commit 2d526f1 into main Sep 5, 2024
7 of 12 checks passed
@joeldrapper joeldrapper deleted the dasherize-symbol-values branch September 5, 2024 20:05
@joelmoss
Copy link
Contributor

joelmoss commented Sep 5, 2024

Can we at least make __attributes__ public then please?

@joeldrapper
Copy link
Collaborator Author

Let’s open an issue for that. There are so many caveats to patching that method, I’m not sure if it’s something we want to encourage.

@joelmoss
Copy link
Contributor

joelmoss commented Sep 5, 2024

@joelmoss it was renamed: #653 (comment)

I even commented on it! 🤦‍♂️

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.

3 participants