0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00

Fix slot tags uncleaned in HTML String (#6948)

* fix: slot regex

* add slot test

* change set

* add test
This commit is contained in:
Chell 2023-05-01 16:49:23 +02:00 committed by GitHub
parent dc062f6695
commit 50975f2ea3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"astro": patch
---
Placeholders for slots are cleaned in HTML String that is rendered

View file

@ -263,7 +263,7 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
if (isPage || renderer?.name === 'astro:jsx') {
yield html;
} else if (html && html.length > 0) {
yield markHTMLString(html.replace(/\<\/?astro-slot\>/g, ''));
yield markHTMLString(html.replace(/\<\/?astro-slot\b[^>]*>/g, ''));
} else {
yield '';
}

View file

@ -16,4 +16,10 @@ describe('Slots with client: directives', () => {
const $ = cheerio.load(html);
expect($('script')).to.have.a.lengthOf(1);
});
it('Astro slot tags are cleaned', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
expect($('astro-slot')).to.have.a.lengthOf(0);
});
});