diff --git a/src/compiler/compile/nodes/Text.ts b/src/compiler/compile/nodes/Text.ts index 7500f5ff30..bb2082e073 100644 --- a/src/compiler/compile/nodes/Text.ts +++ b/src/compiler/compile/nodes/Text.ts @@ -12,7 +12,7 @@ export default class Text extends Node { super(component, parent, scope, info); this.data = info.data; - if (!component.component_options.preserveWhitespace && !/\S/.test(info.data)) { + let node = parent; while (node) { if (node.type === 'Element' && node.name === 'pre') { @@ -21,7 +21,6 @@ export default class Text extends Node { node = node.parent; } - this.use_space = true; - } + } } diff --git a/src/compiler/compile/render-dom/wrappers/Text.ts b/src/compiler/compile/render-dom/wrappers/Text.ts index 1781eb2e58..c83fd38f2c 100644 --- a/src/compiler/compile/render-dom/wrappers/Text.ts +++ b/src/compiler/compile/render-dom/wrappers/Text.ts @@ -54,7 +54,7 @@ export default class TextWrapper extends Wrapper { block.add_element( this.var, - this.node.use_space ? (this.node.data && this.node.data.charCodeAt(0) === 160) ? `@nbsp()` : `@space()` : `@text(${stringify(this.data)})`, + `@text(${stringify(this.data)})`, parent_nodes && `@claim_text(${parent_nodes}, ${stringify(this.data)})`, parent_node ); diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index 30962e74c7..05e18e2bcd 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -62,13 +62,6 @@ export function text(data: string) { return document.createTextNode(data); } -export function space() { - return text(' '); -} - -export function nbsp() { - return text(String.fromCharCode(160)); -} export function empty() { return text('');