diff --git a/site/content/docs/04-compile-time.md b/site/content/docs/04-compile-time.md index 9fa0f92195..ccd37e5426 100644 --- a/site/content/docs/04-compile-time.md +++ b/site/content/docs/04-compile-time.md @@ -48,7 +48,6 @@ The following options can be passed to the compiler. None are required: | `dev` | boolean | `false` | `immutable` | boolean | `false` | `hydratable` | boolean | `false` -| `legacy` | boolean | `false` | `customElement` | boolean | `false` | `tag` | string | null | `accessors` | boolean | `false` @@ -69,7 +68,6 @@ The following options can be passed to the compiler. None are required: | `dev` | `false` | If `true`, causes extra code to be added to components that will perform runtime checks and provide debugging information during development. | `immutable` | `false` | If `true`, tells the compiler that you promise not to mutate any objects. This allows it to be less conservative about checking whether values have changed. | `hydratable` | `false` | If `true` when generating DOM code, enables the `hydrate: true` runtime option, which allows a component to upgrade existing DOM rather than creating new DOM from scratch. When generating SSR code, this adds markers to `
` elements so that hydration knows which to replace. -| `legacy` | `false` | If `true`, generates code that will work in IE9 and IE10, which don't support things like `element.dataset`. | `accessors` | `false` | If `true`, getters and setters will be created for the component's props. If `false`, they will only be created for readonly exported values (i.e. those declared with `const`, `class` and `function`). If compiling with `customElement: true` this option defaults to `true`. | `customElement` | `false` | If `true`, tells the compiler to generate a custom element constructor instead of a regular Svelte component. | `tag` | `null` | A `string` that tells Svelte what tag name to register the custom element with. It must be a lowercase alphanumeric string with at least one hyphen, e.g. `"my-element"`. diff --git a/src/compiler/compile/index.ts b/src/compiler/compile/index.ts index 12b161aeeb..cb8ed1ad81 100644 --- a/src/compiler/compile/index.ts +++ b/src/compiler/compile/index.ts @@ -20,7 +20,6 @@ const valid_options = [ 'accessors', 'immutable', 'hydratable', - 'legacy', 'customElement', 'tag', 'css', diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts index 517ed3ceb6..9bbee442bd 100644 --- a/src/compiler/compile/nodes/Element.ts +++ b/src/compiler/compile/nodes/Element.ts @@ -750,14 +750,6 @@ export default class Element extends Node { } } - if (component.compile_options.legacy && (modifier === 'once' || modifier === 'passive')) { - // TODO this could be supported, but it would need a few changes to - // how event listeners work - component.error(handler, { - code: 'invalid-event-modifier', - message: `The '${modifier}' modifier cannot be used in legacy mode` - }); - } }); if (passive_events.has(handler.name) && handler.can_make_passive && !handler.modifiers.has('preventDefault')) { diff --git a/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts b/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts index ca941b7be9..d156820e26 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts @@ -72,8 +72,6 @@ export default class AttributeWrapper { ? '@xlink_attr' : '@attr'; - const is_legacy_input_type = element.renderer.component.compile_options.legacy && name === 'type' && this.parent.node.name === 'input'; - const dependencies = this.node.get_dependencies(); const value = this.get_value(block); @@ -94,12 +92,7 @@ export default class AttributeWrapper { let updater; const init = should_cache ? x`${last} = ${value}` : value; - if (is_legacy_input_type) { - block.chunks.hydrate.push( - b`@set_input_type(${element.var}, ${init});` - ); - updater = b`@set_input_type(${element.var}, ${should_cache ? last : value});`; - } else if (is_select_value_attribute) { + if (is_select_value_attribute) { // annoying special case const is_multiple_select = element.node.get_static_attribute_value('multiple'); diff --git a/src/compiler/interfaces.ts b/src/compiler/interfaces.ts index a5e286462f..9a7a54347b 100644 --- a/src/compiler/interfaces.ts +++ b/src/compiler/interfaces.ts @@ -118,7 +118,6 @@ export interface CompileOptions { accessors?: boolean; immutable?: boolean; hydratable?: boolean; - legacy?: boolean; customElement?: boolean; tag?: string; css?: boolean; diff --git a/test/js/samples/legacy-input-type/_config.js b/test/js/samples/legacy-input-type/_config.js deleted file mode 100644 index b5141be9ab..0000000000 --- a/test/js/samples/legacy-input-type/_config.js +++ /dev/null @@ -1,5 +0,0 @@ -export default { - options: { - legacy: true - } -}; \ No newline at end of file diff --git a/test/js/samples/legacy-input-type/expected.js b/test/js/samples/legacy-input-type/expected.js deleted file mode 100644 index 2b76a48522..0000000000 --- a/test/js/samples/legacy-input-type/expected.js +++ /dev/null @@ -1,40 +0,0 @@ -/* generated by Svelte vX.Y.Z */ -import { - SvelteComponent, - detach, - element, - init, - insert, - noop, - safe_not_equal, - set_input_type -} from "svelte/internal"; - -function create_fragment(ctx) { - let input; - - return { - c() { - input = element("input"); - set_input_type(input, "search"); - }, - m(target, anchor) { - insert(target, input, anchor); - }, - p: noop, - i: noop, - o: noop, - d(detaching) { - if (detaching) detach(input); - } - }; -} - -class Component extends SvelteComponent { - constructor(options) { - super(); - init(this, options, null, create_fragment, safe_not_equal, {}); - } -} - -export default Component; \ No newline at end of file diff --git a/test/js/samples/legacy-input-type/input.svelte b/test/js/samples/legacy-input-type/input.svelte deleted file mode 100644 index 564f14428c..0000000000 --- a/test/js/samples/legacy-input-type/input.svelte +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/test/validator/index.js b/test/validator/index.js index 9bce5e149b..a60613e042 100644 --- a/test/validator/index.js +++ b/test/validator/index.js @@ -27,7 +27,6 @@ describe("validate", () => { try { const { warnings } = svelte.compile(input, { dev: config.dev, - legacy: config.legacy, generate: false, customElement: config.customElement, ...options, diff --git a/test/validator/samples/event-modifiers-legacy/_config.js b/test/validator/samples/event-modifiers-legacy/_config.js deleted file mode 100644 index 0179e05ec4..0000000000 --- a/test/validator/samples/event-modifiers-legacy/_config.js +++ /dev/null @@ -1,3 +0,0 @@ -export default { - legacy: true -}; \ No newline at end of file diff --git a/test/validator/samples/event-modifiers-legacy/errors.json b/test/validator/samples/event-modifiers-legacy/errors.json deleted file mode 100644 index 2e340b7b2f..0000000000 --- a/test/validator/samples/event-modifiers-legacy/errors.json +++ /dev/null @@ -1,15 +0,0 @@ -[{ - "message": "The 'once' modifier cannot be used in legacy mode", - "code": "invalid-event-modifier", - "start": { - "line": 1, - "column": 8, - "character": 8 - }, - "end": { - "line": 1, - "column": 37, - "character": 37 - }, - "pos": 8 -}] diff --git a/test/validator/samples/event-modifiers-legacy/input.svelte b/test/validator/samples/event-modifiers-legacy/input.svelte deleted file mode 100644 index c53a616fb5..0000000000 --- a/test/validator/samples/event-modifiers-legacy/input.svelte +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file