Skip to content

Conversation

kresnasatya
Copy link
Contributor

The references come from: https://github.com/sveltejs/svelte/blob/main/packages/svelte/src/escaping.js (Svelte 5) and https://github.com/sveltejs/svelte/blob/svelte-4/packages/svelte/src/shared/utils/escape.js (Svelte 4). By using the built-in function, we can reduce third-party dep on Svelte package.

@kresnasatya
Copy link
Contributor Author

Hmm, I'm confused why I fail in coding standards. I have run pnpm run format.

Copy link
Collaborator

@pedroborges pedroborges left a comment

Choose a reason for hiding this comment

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

I’m on board with this change 👍 The Svelte escape is a better fit for our attribute use case, since it escapes exactly what we need, avoids over-escaping, and seems to be bit more efficient.

@kresnasatya please make sure to pass the second true argument so it escapes correctly for an HTML attribute.

@kresnasatya kresnasatya mentioned this pull request Aug 23, 2025
4 tasks
@kresnasatya
Copy link
Contributor Author

I’m on board with this change 👍 The Svelte escape is a better fit for our attribute use case, since it escapes exactly what we need, avoids over-escaping, and is also seems to be bit more efficient.

@kresnasatya please make to pass the second true argument so it escapes correctly for an HTML attribute.

Alright. I have added it. Please review @pedroborges . Thank you.

Copy link
Collaborator

@pedroborges pedroborges left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks, @kresnasatya.

I'll let @pascalbaljet have the final word on merging this 😉

@pedroborges pedroborges added the svelte Related to the svelte adapter label Aug 25, 2025
@pedroborges
Copy link
Collaborator

@pascalbaljet I fixed the merge conflict but now these ES2020 checks for React and Vue are failing, I'm not sure what those are about. Any ideas?

@pascalbaljet
Copy link
Member

@pascalbaljet I fixed the merge conflict but now these ES2020 checks for React and Vue are failing, I'm not sure what those are about. Any ideas?

Ah yes, npmjs is giving 403/409/422 errors all day in CI, nothing to worry about it seems :)

@pascalbaljet
Copy link
Member

Can't we use escape from lodash-es? We're already using that in the <Head> components. That would avoid having to maintain this code ourselves.

@pascalbaljet pascalbaljet added the needs more info/work Needs more info from the author or additional work to get merged label Aug 27, 2025
@pedroborges
Copy link
Collaborator

@kresnasatya please give lodash-es escape a try and run the tests. From a little research I did it seems very similar to the escape utility from Svelte.

@kresnasatya
Copy link
Contributor Author

I see the escape function from lodash-es pass the svelte test. How do you think @pedroborges? If it's okay then, I just need one more commit to remove the escape.ts from the Svelte package.

Copy link
Collaborator

@pedroborges pedroborges left a comment

Choose a reason for hiding this comment

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

Nice! Only thing left is removing escape.ts.

Copy link
Collaborator

@pedroborges pedroborges left a comment

Choose a reason for hiding this comment

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

👍

@kresnasatya
Copy link
Contributor Author

Alright, all is good. Feel free to check again @pedroborges

@pascalbaljet
Copy link
Member

Thanks!

@pascalbaljet pascalbaljet merged commit 62681e6 into inertiajs:master Sep 2, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info/work Needs more info from the author or additional work to get merged svelte Related to the svelte adapter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants