remove legacy mode

pull/4918/head
pushkine 5 years ago
parent f46b38a308
commit 9192f7b6db

@ -48,7 +48,6 @@ The following options can be passed to the compiler. None are required:
| `dev` | boolean | `false` | `dev` | boolean | `false`
| `immutable` | boolean | `false` | `immutable` | boolean | `false`
| `hydratable` | boolean | `false` | `hydratable` | boolean | `false`
| `legacy` | boolean | `false`
| `customElement` | boolean | `false` | `customElement` | boolean | `false`
| `tag` | string | null | `tag` | string | null
| `accessors` | boolean | `false` | `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. | `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. | `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 `<head>` elements so that hydration knows which to replace. | `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 `<head>` 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`. | `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. | `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"`. | `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"`.

@ -20,7 +20,6 @@ const valid_options = [
'accessors', 'accessors',
'immutable', 'immutable',
'hydratable', 'hydratable',
'legacy',
'customElement', 'customElement',
'tag', 'tag',
'css', 'css',

@ -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')) { if (passive_events.has(handler.name) && handler.can_make_passive && !handler.modifiers.has('preventDefault')) {

@ -72,8 +72,6 @@ export default class AttributeWrapper {
? '@xlink_attr' ? '@xlink_attr'
: '@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 dependencies = this.node.get_dependencies();
const value = this.get_value(block); const value = this.get_value(block);
@ -94,12 +92,7 @@ export default class AttributeWrapper {
let updater; let updater;
const init = should_cache ? x`${last} = ${value}` : value; const init = should_cache ? x`${last} = ${value}` : value;
if (is_legacy_input_type) { if (is_select_value_attribute) {
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) {
// annoying special case // annoying special case
const is_multiple_select = element.node.get_static_attribute_value('multiple'); const is_multiple_select = element.node.get_static_attribute_value('multiple');

@ -118,7 +118,6 @@ export interface CompileOptions {
accessors?: boolean; accessors?: boolean;
immutable?: boolean; immutable?: boolean;
hydratable?: boolean; hydratable?: boolean;
legacy?: boolean;
customElement?: boolean; customElement?: boolean;
tag?: string; tag?: string;
css?: boolean; css?: boolean;

@ -1,5 +0,0 @@
export default {
options: {
legacy: true
}
};

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

@ -27,7 +27,6 @@ describe("validate", () => {
try { try {
const { warnings } = svelte.compile(input, { const { warnings } = svelte.compile(input, {
dev: config.dev, dev: config.dev,
legacy: config.legacy,
generate: false, generate: false,
customElement: config.customElement, customElement: config.customElement,
...options, ...options,

@ -1,3 +0,0 @@
export default {
legacy: true
};

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

@ -1 +0,0 @@
<button on:click|once="{handleClick}"></button>
Loading…
Cancel
Save