diff --git a/src/compile/Component.ts b/src/compile/Component.ts index a3108aeabc..f7c1c7dc5d 100644 --- a/src/compile/Component.ts +++ b/src/compile/Component.ts @@ -113,6 +113,7 @@ export default class Component { aliases: Map = new Map(); used_names: Set = new Set(); + globally_used_names: Set = new Set(); constructor( ast: Ast, @@ -349,7 +350,8 @@ export default class Component { let i = 1; reserved.has(alias) || this.var_lookup.has(alias) || - this.used_names.has(alias); + this.used_names.has(alias) || + this.globally_used_names.has(alias); alias = `${name}_${i++}` ); this.used_names.add(alias); @@ -377,6 +379,7 @@ export default class Component { alias = `${name}_${i++}` ); local_used_names.add(alias); + this.globally_used_names.add(alias); return alias; }; } diff --git a/src/compile/render-dom/wrappers/MustacheTag.ts b/src/compile/render-dom/wrappers/MustacheTag.ts index f6656a66ca..f42d0c1de0 100644 --- a/src/compile/render-dom/wrappers/MustacheTag.ts +++ b/src/compile/render-dom/wrappers/MustacheTag.ts @@ -20,7 +20,7 @@ export default class MustacheTagWrapper extends Tag { block.add_element( this.var, - `@create_text(${init})`, + `@text(${init})`, parent_nodes && `@claim_text(${parent_nodes}, ${init})`, parent_node ); diff --git a/src/compile/render-dom/wrappers/Text.ts b/src/compile/render-dom/wrappers/Text.ts index 8f4ba61cec..c83fd38f2c 100644 --- a/src/compile/render-dom/wrappers/Text.ts +++ b/src/compile/render-dom/wrappers/Text.ts @@ -54,7 +54,7 @@ export default class TextWrapper extends Wrapper { block.add_element( this.var, - `@create_text(${stringify(this.data)})`, + `@text(${stringify(this.data)})`, parent_nodes && `@claim_text(${parent_nodes}, ${stringify(this.data)})`, parent_node ); diff --git a/src/internal/dom.js b/src/internal/dom.js index 2a927c8b94..0b8173c3d1 100644 --- a/src/internal/dom.js +++ b/src/internal/dom.js @@ -42,7 +42,7 @@ export function svg_element(name) { return document.createElementNS('http://www.w3.org/2000/svg', name); } -export function create_text(data) { +export function text(data) { return document.createTextNode(data); } @@ -146,7 +146,7 @@ export function claim_text(nodes, data) { } } - return create_text(data); + return text(data); } export function set_data(text, data) { diff --git a/test/runtime/index.js b/test/runtime/index.js index 5f5d6eb573..579dc665c6 100644 --- a/test/runtime/index.js +++ b/test/runtime/index.js @@ -115,7 +115,7 @@ describe("runtime", () => { mod = require(`./samples/${dir}/main.svelte`); SvelteComponent = mod.default; } catch (err) { - showOutput(cwd, compileOptions, svelte.compile); // eslint-disable-line no-console + showOutput(cwd, compileOptions, compile); // eslint-disable-line no-console throw err; } @@ -186,13 +186,13 @@ describe("runtime", () => { } } else { failed.add(dir); - showOutput(cwd, compileOptions, svelte.compile); // eslint-disable-line no-console + showOutput(cwd, compileOptions, compile); // eslint-disable-line no-console throw err; } }) .then(() => { if (config.show) { - showOutput(cwd, compileOptions, svelte.compile); + showOutput(cwd, compileOptions, compile); } flush(); diff --git a/test/runtime/samples/attribute-casing/_config.js b/test/runtime/samples/attribute-casing/_config.js index 27d496da9d..f706c769b9 100644 --- a/test/runtime/samples/attribute-casing/_config.js +++ b/test/runtime/samples/attribute-casing/_config.js @@ -11,7 +11,7 @@ export default { `, - test({ assert, component, target }) { + test({ assert, target }) { const attr = sel => target.querySelector(sel).attributes[0].name; assert.equal(attr('div'), 'class');