Skip to content

Commit

Permalink
Use IE conditional comment placeholders for server island start markers
Browse files Browse the repository at this point in the history
These placeholders are much less likely to be removed by HTML minifiers,
because they have traditionally been used to change the behavior of
site.
  • Loading branch information
markjaquith committed Sep 28, 2024
1 parent 2594eb0 commit 660fd38
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/astro/src/runtime/server/render/server-islands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function renderServerIsland(
}
}

destination.write('<!--server-island-start-->');
destination.write('<!--[if astro]>server-island-start<![endif]-->');

// Render the slots
const renderedSlots: Record<string, string> = {};
Expand Down Expand Up @@ -88,7 +88,7 @@ if(response.status === 200 && response.headers.get('content-type') === 'text/htm
// Swap!
while(script.previousSibling &&
script.previousSibling.nodeType !== 8 &&
script.previousSibling.data !== 'server-island-start') {
script.previousSibling.data !== '[if astro]>server-island-start<![endif]') {
script.previousSibling.remove();
}
script.previousSibling?.remove();
Expand Down

0 comments on commit 660fd38

Please sign in to comment.