Lint and format src/compiler/compile/render_ssr/handlers/Text.js

pull/8569/head
Simon Holthausen 3 years ago
parent 306b2914c8
commit 2653a6518b

@ -6,19 +6,17 @@ import { escape_html } from '../../utils/stringify.js';
* @param {import('../Renderer.js').RenderOptions} _options
*/
export default function (node, renderer, _options) {
let text = node.data;
if (node.use_space()) {
text = ' ';
}
else if (!node.parent ||
node.parent.type !== 'Element' ||
(( /** @type {import('../../nodes/Element.js').default} */(node.parent)).name !== 'script' && ( /** @type {import('../../nodes/Element.js').default} */(node.parent)).name !== 'style')) {
// unless this Text node is inside a <script> or <style> element, escape &,<,>
text = escape_html(text);
}
renderer.add_string(text);
let text = node.data;
if (node.use_space()) {
text = ' ';
} else if (
!node.parent ||
node.parent.type !== 'Element' ||
(/** @type {import('../../nodes/Element.js').default} */ (node.parent).name !== 'script' &&
/** @type {import('../../nodes/Element.js').default} */ (node.parent).name !== 'style')
) {
// unless this Text node is inside a <script> or <style> element, escape &,<,>
text = escape_html(text);
}
renderer.add_string(text);
}

Loading…
Cancel
Save