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

LinkPrefetchObserver: replace dataset with getAttribute #1148

Merged
merged 1 commit into from Jan 31, 2024

Conversation

seanpdoyle
Copy link
Contributor

@seanpdoyle seanpdoyle commented Jan 31, 2024

First, import the StreamMessage module to utilize the contentType
instead of the hard-coded "text/vnd.turbo-stream.html" String.

Next, replace occurrences of HTMLElement.dataset with the
"data-"-prefixed calls to Element.getAttribute so that they are as
grep-able as their counterparts elsewhere in the codebase.

Finally, remove a link comparison conditional clause, since it's
repeated verbatim several lines prior to it.

First, import the `StreamMessage` module to utilize the `contentType`
instead of the hard-coded `"text/vnd.turbo-stream.html"` String.

Next, replace occurrences of [HTMLElement.dataset][] with the
`"data-"`-prefixed calls to [Element.getAttribute][] so that they are as
`grep`-able as their counterparts elsewhere in the codebase.

Finally, remove a `link` comparison conditional clause, since it's
repeated verbatim several lines prior to it.

[HTMLElement.dataset]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset
[Element.getAttribute]: https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
@afcapel afcapel merged commit f81f9c2 into hotwired:main Jan 31, 2024
1 check passed
@afcapel
Copy link
Collaborator

afcapel commented Jan 31, 2024

Thanks @seanpdoyle !

@seanpdoyle seanpdoyle deleted the link-prefetch-data-attributes branch January 31, 2024 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants