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

Simplify HTML attribute token list merging #14

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

seanpdoyle
Copy link
Owner

@seanpdoyle seanpdoyle commented Oct 24, 2024

Rely on view context's #token_list to merge token lists.

Manipulating the token list manually (through calls to String#split and Array#join) had the potential to affect
ActiveSupport::SafeBuffer HTML safety.

This commit replaces that bespoke logic with calls to ActionView::Helpers::TagHelper#token_list to rely entirely on the view for managing the escaping, safety, and joining of the String values.

Rely on view context's `#token_list` to merge token lists.

Manipulating the token list manually (through calls to `String#split`
and `Array#join`) had the potential to affect
`ActiveSupport::SafeBuffer` HTML safety.

This commit replaces that bespoke logic with calls to
[ActionView::Helpers::TagHelper#token_list][] to rely entirely on the
view for managing the escaping, safety, and joining of the String
values.

[]: https://edgeapi.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-token_list
@seanpdoyle seanpdoyle force-pushed the use-view-to-merge-token-lists branch from 56e9a9d to fa95dd4 Compare October 24, 2024 17:27
@seanpdoyle seanpdoyle merged commit 83b44b7 into main Oct 24, 2024
19 checks passed
@seanpdoyle seanpdoyle deleted the use-view-to-merge-token-lists branch October 24, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant