Why filter space?

pull/3024/head
qintarp 6 years ago
parent 4f61dfc338
commit 0a119d3e27

@ -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;
}
}
}

@ -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
);

@ -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('');

Loading…
Cancel
Save