mirror of https://github.com/sveltejs/svelte
parent
abf257306b
commit
508e30c681
@ -1,7 +1 @@
|
||||
<script>
|
||||
import Counter from "./lib/Counter.svelte";
|
||||
</script>
|
||||
|
||||
<div>
|
||||
Hello world!
|
||||
</div>
|
||||
{@html false ? 'foo' : 'bar'}
|
||||
|
@ -1,10 +1,19 @@
|
||||
import { x } from 'code-red';
|
||||
|
||||
/**
|
||||
* @param {import('../../nodes/RawMustacheTag.js').default} node
|
||||
* @param {import('../Renderer.js').default} renderer
|
||||
* @param {import('../private.js').RenderOptions} options
|
||||
*/
|
||||
export default function (node, renderer, options) {
|
||||
if (options.hydratable) renderer.add_string('<!-- HTML_TAG_START -->');
|
||||
if (!options.hydratable) {
|
||||
renderer.add_expression(/** @type {import('estree').Expression} */ (node.expression.node));
|
||||
if (options.hydratable) renderer.add_string('<!-- HTML_TAG_END -->');
|
||||
} else {
|
||||
renderer.add_expression(x`(() => {
|
||||
const #html_string = ${node.expression.node} + '';
|
||||
const #hash = /* @__PURE__ */ @hash(#html_string);
|
||||
|
||||
return \`<!-- HTML_\${#hash}_START -->\${#html_string}<!-- HTML_\${#hash}_END -->\`;
|
||||
})()`);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
<p><!-- HTML_TAG_START --></p>
|
||||
<p><!-- HTML_2920328455_START --></p>
|
||||
<p>invalid</p>
|
||||
<!-- HTML_TAG_END -->
|
||||
<!-- HTML_2920328455_END -->
|
||||
<p></p>
|
||||
<p><!-- HTML_TAG_START --></p>
|
||||
<p><!-- HTML_2920328455_START --></p>
|
||||
<p>invalid</p>
|
||||
<!-- HTML_TAG_END -->
|
||||
<!-- HTML_2920328455_END -->
|
||||
<p></p>
|
||||
|
Before Width: | Height: | Size: 106 B After Width: | Height: | Size: 120 B |
@ -1,4 +1,4 @@
|
||||
<!-- HTML_TAG_START -->
|
||||
<!-- HTML_2526333745_START -->
|
||||
<p>this is some html</p>
|
||||
<p>and so is this</p>
|
||||
<!-- HTML_TAG_END -->
|
||||
<!-- HTML_2526333745_END -->
|
||||
|
Loading…
Reference in new issue