From e9b2234e7ca841e53513013ff66b6a3bca2955e6 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 6 Dec 2018 22:48:30 -0500 Subject: [PATCH] couple of fixes --- src/parse/state/tag.ts | 3 ++- test/js/samples/bind-width-height/expected.js | 5 +++++ test/js/samples/media-bindings/expected.js | 1 - test/parser/samples/script-comment-only/output.json | 4 +--- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/parse/state/tag.ts b/src/parse/state/tag.ts index c34f3d5d2a..028e73e7ad 100644 --- a/src/parse/state/tag.ts +++ b/src/parse/state/tag.ts @@ -232,7 +232,8 @@ export default function tag(parser: Parser) { const special = specials.get(name); parser.eat('>', true); - parser[special.property].push(special.read(parser, start, element.attributes)); + const content = special.read(parser, start, element.attributes); + if (content) parser[special.property].push(content); return; } diff --git a/test/js/samples/bind-width-height/expected.js b/test/js/samples/bind-width-height/expected.js index b57e895541..99308fdca1 100644 --- a/test/js/samples/bind-width-height/expected.js +++ b/test/js/samples/bind-width-height/expected.js @@ -47,6 +47,11 @@ function define($$self, $$props, $$make_dirty) { } $$self.$$.get = () => ({ w, h, div_resize_handler }); + + $$self.$$.set = $$props => { + if ('w' in $$props) w = $$props.w; + if ('h' in $$props) h = $$props.h; + }; } class SvelteComponent extends SvelteComponent_1 { diff --git a/test/js/samples/media-bindings/expected.js b/test/js/samples/media-bindings/expected.js index 5487b2d0b2..83ca52634a 100644 --- a/test/js/samples/media-bindings/expected.js +++ b/test/js/samples/media-bindings/expected.js @@ -58,7 +58,6 @@ function create_fragment(component, ctx) { } function define($$self, $$props, $$make_dirty) { - // TODO some of these are read-only... let { buffered, seekable, played, currentTime, duration, paused, volume } = $$props; function audio_timeupdate_handler() { diff --git a/test/parser/samples/script-comment-only/output.json b/test/parser/samples/script-comment-only/output.json index badcce4de9..5e18e97e74 100644 --- a/test/parser/samples/script-comment-only/output.json +++ b/test/parser/samples/script-comment-only/output.json @@ -21,7 +21,5 @@ ] }, "css": [], - "js": [ - null - ] + "js": [] } \ No newline at end of file