Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/stale-laws-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sveltejs/kit": patch
---

fix: properly handle percent-encoded anchors (e.g. `<a href="#sparkles-%E2%9C%A8">`) during prerendering.
6 changes: 3 additions & 3 deletions packages/kit/src/core/postbuild/crawl.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { resolve } from '../../utils/url.js';
import { resolve, decode_uri } from '../../utils/url.js';
import { decode } from './entities.js';

const DOCTYPE = 'DOCTYPE';
Expand Down Expand Up @@ -193,11 +193,11 @@ export function crawl(html, base) {
}

if (id) {
ids.push(id);
ids.push(decode_uri(id));
}

if (name && tag === 'A') {
ids.push(name);
ids.push(decode_uri(name));
}

if (src) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<body>
<a href="#sparkles-%E2%9C%A8">✨</a>
<h1 id="sparkles-%E2%9C%A8">Title</h1>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"hrefs": ["/#sparkles-%E2%9C%A8"],
"ids": ["sparkles-✨"]
}
Loading